Currently I have created a multisite for my client. Within the network, there are a (primary)corporate site, a newsbites site and a blog site. Is there a way to query the primary site link, so that newsbites and blog site can connect back to the (primary) corporate site, without hard coding the site url?
network_home_url( $path = '', $scheme = null ).
You can see it in
// Root of main site $network_home = network_home_url(); // About page on main site $network_about = network_home_url( 'about/' );
In a network, the main site has always the same ID as the network ID.
get_current_site() which return the global variable (sigh)
$current_site, an instance of
stdClass. This one is filled in
wp-includes/ms-settings.php, which in turn is loaded in
wp-settings.php before mu-plugins are loaded.
So you can rely on it in your plugin or theme.