The MU forums have moved to WordPress.org

How to get the current blog ID (1 post)

  1. ancawonka
    Member
    Posted 12 years ago #

    I didn't find this when I looked earlier, so now that I know I thought someone else might find this helpful...

    If you are trying to get the ID of the current blog (so that you can do something in the database or something) you won't find it using the get_bloginfo() function.

    However, there are two places where you can get it:

    1. From the $current_blog global variable ($current_blog->blog_id)
    2. From the Database object: ($wpdb->blogid)

    Thanks to Donncha for this pointer.

About this Topic

  • Started 12 years ago by ancawonka