Just recently I ran into a case where I had to quickly look something up in the database of my WordPress development environment. I typically do this via a program called Sequel Pro, which helps give some visualization to your database. I love Command Line tools, but sometimes I prefer the visuals to do some troubleshooting.

If you’ve ever looked at a WordPress database, you’ll typically see tables like wp_posts, wp_postameta, and wp_options. In multisite however, things like the posts table, postmeta and options are in tables that contain the blog_id, giving us wp_3_posts, wp_3_postmeta, and wp_3_options. No problem at all if your multisite only has a couple sites setup, but when you use it for your development environment, you get something like this:

Screen Shot 2015-02-20 at 11.32.51 AM

Determining what blog ID you are looking at, isn’t quite easy. So here’s a quick snippet that will drop the current blog ID in the admin header, like so:

Screen Shot 2015-02-20 at 11.35.06 AM

function kfg_toolbar_blog_id( $wp_admin_bar ) {
	$args = array(
		'id'    => 'blog_id',
		'title' => 'Blog #' . get_current_blog_id()
	$wp_admin_bar->add_node( $args );
add_action( 'admin_bar_menu', 'kfg_toolbar_blog_id', 999 );

Posted by Chris Klosowski

Chris Klosowski is the Director of Technology at Sandhills Development, LLC, creators of fine WordPress plugins, and ecommerce solutions.


  1. […] In addition to all the default items that show up in a Network Install I’ve got items added by Query Monitor, Airplane Mode, Debug Bar, Plugin Toggle, and my own Blog ID item. […]


  2. We’re a group of volunteers and opening a new scheme in our community.
    Your site provided us with valuable info to work
    on. You’ve done an impressive job and our entire community will be thankful to you.


Leave a reply

Your email address will not be published. Required fields are marked *