The MU forums have moved to WordPress.org

Blog ID (8 posts)

  1. adaptiman
    Member
    Posted 17 years ago #

    Is there a function that returns the current blog ID number? that is, the blog prefix number?

  2. drmike
    Member
    Posted 17 years ago #

    $blog_id

    It's not a function but a variable passed through the code.

    Regards,
    -drmike

  3. adaptiman
    Member
    Posted 17 years ago #

    I tried that. I think it's too early in the stream because I get

    Undefined variable: blog_id

    I'm putting the call in the main index.php page prior to the main wp-blog-header.php include. Maybe that's the problem.

    Is there a way to call the variable prior to this include?

  4. drmike
    Member
    Posted 17 years ago #

    You're not forgetting the dollar sign, are you?

    I can't do a search through the code on this computer. It's going to have to be tomorrow before I check this out.

    What are you trying to do anyway?

  5. lunabyte
    Member
    Posted 17 years ago #

    Gotta call it as a global, first.

  6. drmike
    Member
    Posted 17 years ago #

    I was looking at the globals but I would thik it would be where you called it from.

  7. bunshi
    Member
    Posted 17 years ago #

    Seems that I get an error if I try to use $blog_id with out
    global $blog_id;
    first.

  8. lunabyte
    Member
    Posted 17 years ago #

    function fubar() {
    global $blog_id;
    
    echo $blog_id;
    }

    That the very basics of it, but you get the idea.
    Gotta make it available to the function if it needs it.
    No different than wpdb, or others.

About this Topic

  • Started 17 years ago by adaptiman
  • Latest reply from lunabyte