W3cubDocs

/WordPress

update_blog_option( int $id, string $option, mixed $value, mixed $deprecated = null ): bool

Updates an option for a particular blog.

Parameters

$idintrequired
The blog ID.
$optionstringrequired
The option key.
$valuemixedrequired
The option value.
$deprecatedmixedoptional
Not used.

Default:null

Return

bool True if the value was updated, false otherwise.

Source

function update_blog_option( $id, $option, $value, $deprecated = null ) {
	$id = (int) $id;

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

	if ( get_current_blog_id() === $id ) {
		return update_option( $option, $value );
	}

	switch_to_blog( $id );
	$return = update_option( $option, $value );
	restore_current_blog();

	return $return;
}

Changelog

Version Description
MU (3.0.0) Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/update_blog_option