The WordPress multi-site obtains the current blog information. Www. utubon. com1495wordpress-multisite-get-current-bolg-infoglobal $ current_blog; The Returned result is: stdClassObject ([blog_id] 3 [site_id] 1 [domain] demo. utu http://www.utubon.com/1495/wordpress-multisite-get-current-bolg-info
global $current_blog;
The returned 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 useGet_blog_detailsFunction:
$current_blog = get_blog_details();
The returned 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] => 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. However, there is another method that is relatively difficult to use.Get_blog_id_from_urlFunction. If you use sub-directories for multiple sites, 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");
The above parameters can be used$ _ SERVER ['server _ name']And$ _ SERVER ["REQUEST_URI"].
After obtaining $ blog_id, you can easily perform various tasks.
Http://www.bkjia.com/PHPjc/738537.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/738537.htmlTechArticlehttp://www.utubon.com/1495/wordpress-multisite-get-current-bolg-info global $ current_blog; its returned result is: stdClass Object ([blog_id] = 3 [site_id] = 1 [domain] = demo. utu...