update_blog_status()WP 3.0.0

Updates a blog details field.

No Hooks.

Return

String|false. $value

Usage

update_blog_status( $blog_id, $pref, $value, $deprecated );
$blog_id(int) (required)
Blog ID.
$pref(string) (required)
Field name.
$value(string) (required)
Field value.
$deprecated(null)
Not used.
Default: null

Notes

  • Global. wpdb. $wpdb WordPress database abstraction object.

Changelog

Since 3.0.0 Introduced.
Since 5.1.0 Use wp_update_site() internally.

update_blog_status() code WP 6.6.2

function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
	global $wpdb;

	if ( null !== $deprecated ) {
		_deprecated_argument( __FUNCTION__, '3.1.0' );
	}

	$allowed_field_names = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );

	if ( ! in_array( $pref, $allowed_field_names, true ) ) {
		return $value;
	}

	$result = wp_update_site(
		$blog_id,
		array(
			$pref => $value,
		)
	);

	if ( is_wp_error( $result ) ) {
		return false;
	}

	return $value;
}