这是我们如何做到百分之百的,因为我们在网络安装中有多个主要站点:
function name_ly_get_main_blog_id () {
global $current_site;
global $wpdb;
return $wpdb->get_var ( $wpdb->prepare ( "SELECT `blog_id` FROM `$wpdb->blogs` WHERE `domain` = \'%s\' AND `path` = \'%s\' ORDER BY `blog_id` ASC LIMIT 1", $current_site->domain, $current_site->path ) );
}