The get_blog_status() WordPress PHP function retrieves a specific field from the blog details.
Usage
To use the function, simply pass in the blog ID and the field name you want to retrieve. For example:
$blog_id = 1; $field = 'public'; $result = get_blog_status($blog_id, $field);
Parameters
$id
(int) – Required. The ID of the blog you want to retrieve details from.$pref
(string) – Required. The name of the field you want to retrieve.
More information
See WordPress Developer Resources: get_blog_status()
Examples
Get blog status of ‘archived’
This example retrieves the archived status of a blog with ID 1.
$blog_id = 1; $field = 'archived'; $is_archived = get_blog_status($blog_id, $field);
Get blog status of ‘mature’
This example retrieves the mature status of a blog with ID 2.
$blog_id = 2; $field = 'mature'; $is_mature = get_blog_status($blog_id, $field);
Get blog status of ‘spam’
This example retrieves the spam status of a blog with ID 3.
$blog_id = 3; $field = 'spam'; $is_spam = get_blog_status($blog_id, $field);
Get blog status of ‘deleted’
This example retrieves the deleted status of a blog with ID 4.
$blog_id = 4; $field = 'deleted'; $is_deleted = get_blog_status($blog_id, $field);
Get blog status of ‘public’
This example retrieves the public status of a blog with ID 5.
$blog_id = 5; $field = 'public'; $is_public = get_blog_status($blog_id, $field);