update_blog_option( int $id, string $option, mixed $value, mixed $deprecated = null )
Update an option for a particular blog.
Description Description
Parameters 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
Return Return
(bool) True on success, false on failure.
Source 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;
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| MU (3.0.0) | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
The return documentation states:
However, this is not true. This function uses
update_option()under the hood, and returns its result verbatim. It’s not in the reference, but the Codex doc ofupdate_option()states:update_option()will returnfalseif the value has not changed, such as if the new value is the same as the old, and therefore so willupdate_blog_option(). Thus, just because it returnsfalsedoes not mean there was an error.Also, see this helpful comment.