public function add( $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 = wp_slash( $meta_value );
		$success    = $this->add_metadata( $object_id, $meta_key, $meta_value );

		if ( $success ) {
			WP_CLI::success( 'Added custom field.' );
		} else {
			WP_CLI::error( 'Failed to add custom field.' );
		}
	}
public function add( $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 = wp_slash( $meta_value );
		$success    = $this->add_metadata( $object_id, $meta_key, $meta_value );

		if ( $success ) {
			WP_CLI::success( 'Added custom field.' );
		} else {
			WP_CLI::error( 'Failed to add custom field.' );
		}
	}
public function add ( $ 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 = wp_slash ( $ meta_value ) ; $ success = $ this -> add_metadata ( $ object_id , $ meta_key , $ meta_value ) ; if ( $ success ) { WP_CLI :: success ( 'Added custom field.' ) ; } else { WP_CLI :: error ( 'Failed to add custom field.' ) ; } }
Add a meta field.

## OPTIONS

<id>
: The ID of the object.

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

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

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