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.

18 Comments

  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. […]

    Reply

  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.

    Reply

  3. viagra,cialis india what is better viagra or cialis or levitra?? – viagra blindness 2010

    Reply

  4. viagra samsclub when was viagra invented – viagra time to work

    Reply

  5. buy prednisone 5mg canada prednisone online – prednisone where can i buy

    Reply

  6. zithromax online pharmacy canada zithromax for sale – zithromax online pharmacy canada

    Reply

  7. 20mg prednisone buy prednisone – prednisone 2.5 tablet

    Reply

  8. ivermectin cream cost stromectol for sale – ivermectin lotion price

    Reply

  9. ivermectin over the counter stromectol tablets – stromectol

    Reply

  10. buy cheap prescription drugs online ed meds online without doctor prescription – errectile disfunction

    Reply

  11. ed pills otc prescription drugs online without doctor – natural herbs for ed

    Reply

  12. errectile dysfunction ed meds online without prescription or membership – pain meds online without doctor prescription

    Reply

  13. how much is plaquenil pill plaquenil for sale canada – generic for hydroxychloroquine 200 mg

    Reply

  14. lipitor 5mg coupon for lipitor – lipitor online pharmacy

    Reply

  15. stromectol online buy stromectol – buy ivermectin for humans uk

    Reply

  16. plaquenil drug hydroxychloroquine – hydroxychloroquine-o-sulfate

    Reply

  17. cialis for sell real cialis on line ordering – generic cialis testimonials

    Reply

  18. cost of viagra viagra pills – viagra 100mg price

    Reply

Leave a reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.