update_blog_option() WordPress Function

The update_blog_option() function is used to update a blog option for the specified blog. The function takes three arguments: the blog id, the option key, and the option value. The function returns the new option value if the option was updated successfully, or false if the update failed.

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

Update an option for a particular blog.


Parameters

$id

(int)(Required)The blog ID.

$option

(string)(Required)The option key.

$value

(mixed)(Required)The option value.

$deprecated

(mixed)(Optional)Not used.

Default value: null


Top ↑

Return

(bool) True if the value was updated, false otherwise.


Top ↑

Source

File: wp-includes/ms-blogs.php

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


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.