public function update( $args, $assoc_args ) {
		list( $object_id, $meta_key ) = $args;

		$meta_value = WP_CLI::get_value_from_arg_or_stdin( $args, 2 );
		$meta_value = WP_CLI::read_value( $meta_value, $assoc_args );

		$object_id = $this->check_object_id( $object_id );

		$meta_value = sanitize_meta( $meta_key, $meta_value, $this->meta_type );
		$old_value  = sanitize_meta( $meta_key, $this->get_metadata( $object_id, $meta_key, true ), $this->meta_type );

		if ( $meta_value === $old_value ) {
			WP_CLI::success( "Value passed for custom field '{$meta_key}' is unchanged." );
		} else {
			$meta_value = wp_slash( $meta_value );
			$success    = $this->update_metadata( $object_id, $meta_key, $meta_value );

			if ( $success ) {
				WP_CLI::success( "Updated custom field '{$meta_key}'." );
			} else {
				WP_CLI::error( "Failed to update custom field '{$meta_key}'." );
			}
		}

	}
public function update( $args, $assoc_args ) {
		list( $object_id, $meta_key ) = $args;

		$meta_value = WP_CLI::get_value_from_arg_or_stdin( $args, 2 );
		$meta_value = WP_CLI::read_value( $meta_value, $assoc_args );

		$object_id = $this->check_object_id( $object_id );

		$meta_value = sanitize_meta( $meta_key, $meta_value, $this->meta_type );
		$old_value  = sanitize_meta( $meta_key, $this->get_metadata( $object_id, $meta_key, true ), $this->meta_type );

		if ( $meta_value === $old_value ) {
			WP_CLI::success( "Value passed for custom field '{$meta_key}' is unchanged." );
		} else {
			$meta_value = wp_slash( $meta_value );
			$success    = $this->update_metadata( $object_id, $meta_key, $meta_value );

			if ( $success ) {
				WP_CLI::success( "Updated custom field '{$meta_key}'." );
			} else {
				WP_CLI::error( "Failed to update custom field '{$meta_key}'." );
			}
		}

	}
public function update ( $ args , $ assoc_args ) { list ( $ object_id , $ meta_key ) = $ args ; $ meta_value = WP_CLI :: get_value_from_arg_or_stdin ( $ args , 2 ) ; $ meta_value = WP_CLI :: read_value ( $ meta_value , $ assoc_args ) ; $ object_id = $ this -> check_object_id ( $ object_id ) ; $ meta_value = sanitize_meta ( $ meta_key , $ meta_value , $ this -> meta_type ) ; $ old_value = sanitize_meta ( $ meta_key , $ this -> get_metadata ( $ object_id , $ meta_key , true ) , $ this -> meta_type ) ; if ( $ meta_value === $ old_value ) { WP_CLI :: success ( "Value passed for custom field '{$meta_key}' is unchanged." ) ; } else { $ meta_value = wp_slash ( $ meta_value ) ; $ success = $ this -> update_metadata ( $ object_id , $ meta_key , $ meta_value ) ; if ( $ success ) { WP_CLI :: success ( "Updated custom field '{$meta_key}'." ) ; } else { WP_CLI :: error ( "Failed to update custom field '{$meta_key}'." ) ; } } }
Update a meta field.

## OPTIONS

<id>
: The ID of the object.

<key>
: The name of the meta field to update.

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

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

@alias set
Update a meta field .