The MU forums have moved to WordPress.org

How to get the current blog ID (3 posts)

  1. ancawonka
    Member
    Posted 14 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.

  2. DrLightman
    Member
    Posted 14 years ago #

    I was looking for this, thanks.

    I'd suggest adding an API function get_blog_id()... ?

  3. gfazioli
    Member
    Posted 14 years ago #

    Hi, there is $blog_id global too.

About this Topic

  • Started 14 years ago by ancawonka
  • Latest reply from gfazioli