public function update( $args, $assoc_args ) {
		$key = $args[0];

		$value = WP_CLI::get_value_from_arg_or_stdin( $args, 1 );
		$value = WP_CLI::read_value( $value, $assoc_args );

		$autoload = Utils\get_flag_value( $assoc_args, 'autoload' );
		if ( ! in_array( $autoload, [ 'yes', 'no' ], true ) ) {
			$autoload = null;
		}

		$value = sanitize_option( $key, $value );
		// Sanitization WordPress normally performs when getting an option
		if ( in_array( $key, [ 'siteurl', 'home', 'category_base', 'tag_base' ], true ) ) {
			$value = untrailingslashit( $value );
		}
		$old_value = sanitize_option( $key, get_option( $key ) );

		if ( $value === $old_value && null === $autoload ) {
			WP_CLI::success( "Value passed for '{$key}' option is unchanged." );
		} else {
			if ( update_option( $key, $value, $autoload ) ) {
				WP_CLI::success( "Updated '{$key}' option." );
			} else {
				WP_CLI::error( "Could not update option '{$key}'." );
			}
		}
	}
public function update( $args, $assoc_args ) {
		$key = $args[0];

		$value = WP_CLI::get_value_from_arg_or_stdin( $args, 1 );
		$value = WP_CLI::read_value( $value, $assoc_args );

		$autoload = Utils\get_flag_value( $assoc_args, 'autoload' );
		if ( ! in_array( $autoload, [ 'yes', 'no' ], true ) ) {
			$autoload = null;
		}

		$value = sanitize_option( $key, $value );
		// Sanitization WordPress normally performs when getting an option
		if ( in_array( $key, [ 'siteurl', 'home', 'category_base', 'tag_base' ], true ) ) {
			$value = untrailingslashit( $value );
		}
		$old_value = sanitize_option( $key, get_option( $key ) );

		if ( $value === $old_value && null === $autoload ) {
			WP_CLI::success( "Value passed for '{$key}' option is unchanged." );
		} else {
			if ( update_option( $key, $value, $autoload ) ) {
				WP_CLI::success( "Updated '{$key}' option." );
			} else {
				WP_CLI::error( "Could not update option '{$key}'." );
			}
		}
	}
public function update ( $ args , $ assoc_args ) { $ key = $ args [ 0 ] ; $ value = WP_CLI :: get_value_from_arg_or_stdin ( $ args , 1 ) ; $ value = WP_CLI :: read_value ( $ value , $ assoc_args ) ; $ autoload = Utils \ get_flag_value ( $ assoc_args , 'autoload' ) ; if ( ! in_array ( $ autoload , [ 'yes' , 'no' ] , true ) ) { $ autoload = null ; } $ value = sanitize_option ( $ key , $ value ) ; // Sanitization WordPress normally performs when getting an option if ( in_array ( $ key , [ 'siteurl' , 'home' , 'category_base' , 'tag_base' ] , true ) ) { $ value = untrailingslashit ( $ value ) ; } $ old_value = sanitize_option ( $ key , get_option ( $ key ) ) ; if ( $ value === $ old_value && null === $ autoload ) { WP_CLI :: success ( "Value passed for '{$key}' option is unchanged." ) ; } else { if ( update_option ( $ key , $ value , $ autoload ) ) { WP_CLI :: success ( "Updated '{$key}' option." ) ; } else { WP_CLI :: error ( "Could not update option '{$key}'." ) ; } } }
Updates an option value.

## OPTIONS

<key>
: The name of the option to update.

[<value>]
: The new value. If ommited, the value is read from STDIN.

[--autoload=<autoload>]
: Requires WP 4.2. Should this option be automatically loaded.
---
options:
- 'yes'
- 'no'
---

[--format=<format>]
: The serialization format for the value.
---
default: plaintext
options:
- plaintext
- json
---

## EXAMPLES

# Update an option by reading from a file.
$ wp option update my_option < value.txt
Success: Updated 'my_option' option.

# Update one option on multiple sites using xargs.
$ wp site list --field=url | xargs -n1 -I {} sh -c 'wp --url={} option update my_option my_value'
Success: Updated 'my_option' option.
Success: Updated 'my_option' option.

# Update site blog name.
$ wp option update blogname "Random blog name"
Success: Updated 'blogname' option.

# Update site blog description.
$ wp option update blogdescription "Some random blog description"
Success: Updated 'blogdescription' option.

# Update admin email address.
$ wp option update admin_email someone@example.com
Success: Updated 'admin_email' option.

# Set the default role.
$ wp option update default_role author
Success: Updated 'default_role' option.

# Set the timezone string.
$ wp option update timezone_string "America/New_York"
Success: Updated 'timezone_string' option.

@alias set
Updates an option value .