wpseek.com WordPress开发者和主题制作者的搜索引擎 功能 过滤器 动作 常量 XINGTwitterFacebookDelicious 通用信息 源码 get_main_site_id › WordPress FunctionSince4.9.0已弃用n/a› get_main_site_id ( $network_id = null )参数:(int) $network_id Optional. The ID of the network for which to get the main site. Defaults to the current network.Required: No默认: null返回:(int) The ID of the main site.定义在:wp-includes/functions.php , line 6375 文档:developer.wordpress.org / get_main_site_idGets the main site ID.Related Functions: get_main_network_id, is_main_site, get_cat_id, get_the_id, get_site 源码 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; }