add is_main_site() function, See #11644

git-svn-id: http://svn.automattic.com/wordpress/trunk@12714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-01-12 21:52:51 +00:00
parent 6780fa717c
commit 591a31a664
1 changed files with 22 additions and 0 deletions

View File

@ -3461,6 +3461,28 @@ function set_site_transient($transient, $value, $expiration = 0) {
}
}
/**
* is main site
*
*
* @since 3.0.0
* @package WordPress
*
* @param int $blog_id optional blog id to test (default current blog)
* @return bool True if not multisite or $blog_id is main site
*/
function is_main_site( $blog_id = '' ) {
global $current_site, $current_blog;
if ( !is_multisite() )
return true;
if ( !$blog_id )
$blog_id = $current_blog->blog_id;
return $blog_id == $current_site->blog_id;
}
/**
* gmt_offset modification for smart timezone handling
*