WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

WPMU Functions/get blog details

Description

Returns general blog information stored in the wp_blogs table.

Parameters

$fields
(integer) (required) A blog ID, a blog name, or an array of fields to query against.
Default: None
$getall
(boolean) (optional) Flag indicating if all available data or just a subset of data should be returned (see return values, below).
Default: true

Return Values

(object) 
Object containing the following public variables:
blog_id 
(integer) ID of the blog queried.
site_id 
(integer) ID of the site this blog belongs to (as wp_site).
domain 
(string) Domain used to access this blog.
path 
(string) Path used to access this site.
registered 
(string) Date and time this blog was registered.
last_updated 
(string) Date and time this blog was last updated.
public 
(integer) Flag indicating if this blog is public or not.
archived 
(integer) Flag indicating if this blog is archived or not.
mature 
(integer) Flag indicating if this blog has been marked as for a mature audience.
spam 
(integer) Flag indicating if this blog has been marked as spam.
deleted 
(integer) Flag indicating if this blog has been marked as deleted.
lang_id 
(integer) ID of the language this blog is written in.
blogname 
(string) Available only with $getall flag set to true. The name of this blog.
siteurl 
(string) Available only with $getall flag set to true. The URL of the site this blog belongs to.
post_count 
(integer) Available only with $getall flag set to true. The number of posts in this blog.

Usage

<?php get_blog_details$fields$getall ); ?>

Examples

<?php
  $blog_details 
get_blog_details(1);
  echo 
'Blog '.$blog_details->blog_id.' is called '.$blog_details->blogname.'.';
?>

get_blog_details(1); returns an object:

   [blog_id]      => 1
   [site_id]      => 1
   [domain]       => foo-multi-site.com
   [path]         => /site-path/
   [registered]   => 2014-07-31 14:51:09
   [last_updated] => 2014-07-31 15:51:56
   [public]       => 1
   [archived]     => 0
   [mature]       => 0
   [spam]         => 0
   [deleted]      => 0
   [lang_id]      => 0
   [blogname]     => Site Name
   [siteurl]      => http://foo-multi-site.com/this-site
   [post_count]   =>

Notes

To return an object containing all items, use the following syntax: <?php get_blog_details$blogId ); ?>

Alternatively, to return a specific variable from the above items, you can use the following: <?php get_blog_details$blogId )->path?>

Related

switch_to_blog(), ms_is_switched(), restore_current_blog(), get_current_blog_id(), wp_get_sites(), get_blog_details()

See also index of Function Reference and index of Template Tags.