Using WordPress ‘get_blog_details()’ PHP function

The get_blog_details() WordPress PHP function retrieves the details for a blog from the blogs table and blog options.


get_blog_details( $fields, $get_all )

Custom Example:

$blog_details = get_blog_details( 2 );
echo $blog_details->blogname;


  • $fields (int|string|array) (Optional) A blog ID, a blog slug, or an array of fields to query against. Defaults to the current blog ID. Default: null
  • $get_all (bool) (Optional) Whether to retrieve all details or only the details in the blogs table. Default is true. Default: true

More information

See WordPress Developer Resources: get_blog_details()

Note: get_blog_details() was deprecated in favor of get_site().


Get blog details by ID

Retrieve blog details using the blog ID:

$blog_id = 2;
$blog_details = get_blog_details( $blog_id );

Get blog details by slug

Retrieve blog details using the blog slug:

$blog_slug = 'example-blog';
$blog_details = get_blog_details( $blog_slug );

Get specific blog details

Retrieve specific blog details by passing an array of fields:

$blog_id = 2;
$fields = array( 'blogname', 'siteurl' );
$blog_details = get_blog_details( $blog_id, $fields );

Get only blogs table details

Retrieve only the details in the blogs table:

$blog_id = 2;
$blog_details = get_blog_details( $blog_id, false );

Get blog description

To get other information such as blog description, use get_blog_option():

$blog_id = 2;
$blog_description = get_blog_option( $blog_id, 'blogdescription' );