is_main_network()
最后更新于:2021-11-27 08:54:13
is_main_network( int$network_id=null)Determine whether a network is the main network of the Multisite installation.
参数
- $network_id
-
(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.
源文件
文件: gc-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 );
}