If you work with the WordPress Multi-Site feature, you may understand how useful it can be to have the option of easily finding the ID number of your network sites. Unfortunately, WordPress does not include any simple way of finding the site ID, not without hovering your mouse over the link and inspecting the URL.
Well, this function will make your life much easier. Paste the code below into your functions.php and the ID number of each site will now be displayed in a column on the right side of the site browser.
This trick was originally published by WP Engineer.
If you’re not already used to using the site IDs for achieving different effects, here’s an example of how I’ve used this trick.
For the last five months, I’ve been doing a lot of heavy development for a network of sites that relies on the WP multi-site feature. Each site on the network also uses the same theme. Well, because each site is unique in its own way, such as color scheme, layout styles, etc, I needed a way to check which site I was on. The easiest way to do that is first to declare the global $blog_id variable, then check it for the current blog.
This way you can easily change layout styles or colors depending on which site you are currently on, and you can use the functions above to easily find the appropriate blog id.