WordPress Multi-site Get current blog Information _php Tutorial

Source: Internet
Author: User
Tags multisite subdomain name
Http://www.utubon.com/1495/wordpress-multisite-get-current-bolg-info

Global $current _blog;

Its return result is:

StdClass Object (    [blog_id] = 3    [site_id] = 1    [domain] = demo.utubon.com    [path] =/ neighborhood/    [Registered] = 2013-08-01 10:31:03    [last_updated] = 2013-08-01 02:31:03    [public] = > 1    [archived] + 0    [Mature] = 0    [spam] + 0    [deleted] = 0    [lang_id] + 0)

You can also use the get_blog_details function:

$current _blog = Get_blog_details ();

Its return result is:

StdClass Object (    [blog_id] = 3    [site_id] = 1    [domain] = demo.utubon.com    [path] =/ neighborhood/    [Registered] = 2013-08-01 10:31:03    [last_updated] = 2013-08-01 02:31:03    [public] = > 1    [archived] + 0    [Mature] = 0    [spam] + 0    [deleted] = 0    [lang_id] + 0    [Blogname] = Neighborhood    [SiteURL] = Http://demo.utubon.com/neighborhood    [Post_count] =// More information than global $current _blog

This basically satisfies our needs, but there is a more mealy way to use the get_blog_id_from_url function. If your multisite is in the form of subdirectories, use:

$blog _id = Get_blog_id_from_url ("example.com", "/blog1/");

If you are using a subdomain name, use:

$blog _id = Get_blog_id_from_url ("blog1.example.com");

And above these parameters, we can use $_server[' server_name ' and $_server["Request_uri"] get.

All sorts of things will be done after getting $blog_id.

http://www.bkjia.com/PHPjc/738537.html www.bkjia.com true http://www.bkjia.com/PHPjc/738537.html techarticle Http://www.utubon.com/1495/wordpress-multisite-get-current-bolg-info Global $current _blog; The return result is: StdClass Object ([blog_id] = 3 [site_id] = 1 [domain] = Demo.utu ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.