is_main_network

函数


is_main_network ( $network_id = null )
参数
  • (int)
    $network_id
    Optional. Network ID to test. Defaults to current network.
    Required:
    Default: null
返回值
  • (bool) True if $network_id is the main network, or if not running Multisite.
定义位置
  • wp-includes/functions.php
    , line 6180
引入
3.7.0
弃用

Determines whether a network is the main network of the Multisite installation.

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 );
}