update_blog_status( int $blog_id, string $pref, string $value, null $deprecated = null ): string|false

In this article

Updates a blog details field.

Parameters

$blog_idintrequired
Blog ID.
$prefstringrequired
Field name.
$valuestringrequired
Field value.
$deprecatednulloptional
Not used.

Default:null

Return

string|false $value

Source

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;
}

Changelog

VersionDescription
MU (3.0.0)MU (3.0.0)
5.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.