get_main_network_id()
Get the main network ID.
描述
返回值
(int) The ID of the main network.
源代码
File: wp-includes/functions.php
function get_main_network_id() {
if ( ! is_multisite() ) {
return 1;
}
$current_network = get_network();
if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
$main_network_id = PRIMARY_NETWORK_ID;
} elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) {
// If the current network has an ID of 1, assume it is the main network.
$main_network_id = 1;
} else {
$_networks = get_networks( array( 'fields' => 'ids', 'number' => 1 ) );
$main_network_id = array_shift( $_networks );
}
/**
* Filters the main network ID.
*
* @since 4.3.0
*
* @param int $main_network_id The ID of the main network.
*/
return (int) apply_filters( 'get_main_network_id', $main_network_id );
}
更新日志
Version | 描述 |
---|---|
4.3.0 | Introduced. |
相关函数
Uses
-
wp-includes/ms-blogs.php:
get_network() -
wp-includes/ms-blogs.php:
get_networks() -
wp-includes/functions.php:
get_main_network_id -
wp-includes/load.php:
is_multisite() -
wp-includes/plugin.php:
apply_filters()
Used By
-
wp-includes/load.php:
get_current_network_id() -
wp-includes/functions.php:
is_main_network()
你可能对这些文章感兴趣:
- wordpress函数get_the_posts_navigation()用法示例
- wordpress函数get_the_title()用法示例
- wordpress函数get_the_terms()用法示例
- wordpress函数get_the_tags()用法示例
- wordpress函数get_the_taxonomies()用法示例
- wordpress函数get_the_posts_pagination()用法示例
- wordpress函数get_the_permalink()用法示例
- wordpress函数get_the_password_form()用法示例
- wordpress函数get_the_modified_date()用法示例
- wordpress函数get_the_modified_time()用法示例
- wordpress函数get_the_modified_author()用法示例
- wordpress函数get_the_guid()用法示例
- wordpress函数get_the_ID()用法示例
- wordpress函数get_the_excerpt()用法示例
如有疑问,请前往问答中心反馈!
反馈