Skip to main content
SnippetsWordpress

If is site condition for WordPress MultiSite

By April 8, 2020No Comments
$blog_id = get_current_blog_id();
if ( 5 == $blog_id ) {
// do something
}	
} else {
 // do nothing
}	

Checks current blog id for executing custom code on WordPress Network installations. I use this for testing plugin code on a demo site so errors won’t impact the entire network.

Contact us to learn more about Adopt the Web for your business

Author Jarod Thornton

More posts by Jarod Thornton