get_blog_status() WordPress Function

The get_blog_status() function in WordPress allows you to get the status of a blog by its ID. This is useful for checking if a blog is active or not.

get_blog_status( int $id, string $pref ) #

Get a blog details field.


Parameters

$id

(int)(Required)Blog ID.

$pref

(string)(Required)Field name.


Top ↑

Return

(bool|string|null) $value


Top ↑

Source

File: wp-includes/ms-blogs.php

function get_blog_status( $id, $pref ) {
	global $wpdb;

	$details = get_site( $id );
	if ( $details ) {
		return $details->$pref;
	}

	return $wpdb->get_var( $wpdb->prepare( "SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id ) );
}


Top ↑

Changelog

Changelog
VersionDescription
MU (3.0.0)Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.