get_main_site_id()
最后更新于:2021-11-26 09:20:13
get_main_site_id( int$network_id=null)Gets the main site ID.
参数
- $network_id
-
(int) (Optional) The ID of the network for which to get the main site. Defaults to the current network.
Default value: null
响应
(int) The ID of the main site.
源文件
文件: gc-includes/functions.php
function get_main_site_id( $network_id = null ) {
if ( ! is_multisite() ) {
return get_current_blog_id();
}
$network = get_network( $network_id );
if ( ! $network ) {
return 0;
}
return $network->site_id;
}