$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.