How to get the current site's/blog's ID?
-
Sorry if this issue has already been addressed and answered, but I can’t find it anywhere.
How do I/Can I fetch the current site’s ID?
(Or blogs? sorry, not sure which terminology is being used)I would like to set up a check whether you are currently viewing the main site or a sub site, something like;
if ( blog_ID = 1 ) {
You are on the main site
} else {
You are on a sub site
}I found this code in the codex;
<?php $blog_details = get_blog_details(1); echo 'Blog '.$blog_details->blog_id.' is called '.$blog_details->blogname.'.'; ?>
So what I need is to get the ID and insert it where that code suggests a check for Blog ID 1’s details.
Thanks in advance!
/ Carl-Johan
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘How to get the current site's/blog's ID?’ is closed to new replies.