get_blog_details

Home » Functions » get_blog_details

Function Name: get_blog_details

If you’re working with WordPress multisite installations, the get_blog_details() function can be extremely useful.

This function retrieves information about a specific site within a multi-site network installation. It returns an object that contains information such as the site title, description, and URL, among other things.

The function takes a single parameter: the ID of the site you want to retrieve information for. If you omit this parameter or pass a value of zero, the function will return information about the current site.

Here’s an example usage code:

$blog_details = get_blog_details(1);

echo 'Site name: ' . $blog_details->blogname;
echo 'Site description: ' . $blog_details->blogdescription;
echo 'Site URL: ' . $blog_details->siteurl;

In this example, we are retrieving information for the site with an ID of 1. We then use the returned object to display the site name, description, and URL.

Learn More on WordPress.org

Register an account to save your snippets or go Pro to get more features.