Uses
| Uses | Description |
|---|---|
| wp-includes/load.php: get_current_network_id() | Retrieves the current network ID. |
| wp-includes/functions.php: get_main_network_id() | Get the main network ID. |
| wp-includes/load.php: is_multisite() | If Multisite is enabled. |
Determine whether a network is the main network of the Multisite installation.
(int) (Optional) Network ID to test. Defaults to current network.
Default value: null
(bool) True if $network_id is the main network, or if not running Multisite.
File: wp-includes/functions.php
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 );
} | Version | Description |
|---|---|
| 3.7.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_main_network