is_main_network()
Determines whether a network is the main network of the Multisite installation.
No Hooks.
Returns
true|false. True if $network_id is the main network, or if not running Multisite.
Usage
is_main_network( $network_id );
- $network_id(int)
- Network ID to test.
Default:current network
Changelog
| Since 3.7.0 | Introduced. |
is_main_network() is main network code WP 7.0
function is_main_network( $network_id = null ) {
if ( ! is_multisite() ) {
return true;
}
if ( null === $network_id ) {
$network_id = get_current_network_id();
}
$network_id = (int) $network_id;
return ( get_main_network_id() === $network_id );
}