is_main_network() - WordPress 函数参考中文文档

返回介绍

is_main_network()

发布于 2017-09-11 字数1831 浏览 832 评论 0

is_main_network( int $network_id = null )

Determine whether a network is the main network of the Multisite install.


描述


参数

$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.


源代码

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 ( $network_id === get_main_network_id() );
}

更新日志

Version 描述
3.7.0 Introduced.

相关函数

Uses

  • wp-includes/load.php:
    get_current_network_id()
  • wp-includes/functions.php:
    get_main_network_id()
  • wp-includes/load.php:
    is_multisite()

Used By

  • wp-includes/functions.php:
    _wp_upload_dir()
  • wp-admin/includes/upgrade.php:
    wp_should_upgrade_global_tables()
  • wp-admin/includes/class-wp-automatic-updater.php:
    WP_Automatic_Updater::run()
  • wp-admin/includes/schema.php:
    populate_options()
  • wp-admin/includes/upgrade.php:
    upgrade_network()

User Contributed Notes

上一篇:is_main_blog()

下一篇:is_main_query()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!