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

		$meta_key   = ! empty( $args[1] ) ? $args[1] : '';
		$meta_value = ! empty( $args[2] ) ? $args[2] : '';

		if ( empty( $meta_key ) && ! Utils\get_flag_value( $assoc_args, 'all' ) ) {
			WP_CLI::error( 'Please specify a meta key, or use the --all flag.' );
		}

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

		if ( Utils\get_flag_value( $assoc_args, 'all' ) ) {
			$errors = false;
			foreach ( $this->get_metadata( $object_id ) as $meta_key => $values ) {
				$success = $this->delete_metadata( $object_id, $meta_key );
				if ( $success ) {
					WP_CLI::log( "Deleted '{$meta_key}' custom field." );
				} else {
					WP_CLI::warning( "Failed to delete '{$meta_key}' custom field." );
					$errors = true;
				}
			}
			if ( $errors ) {
				WP_CLI::error( 'Failed to delete all custom fields.' );
			} else {
				WP_CLI::success( 'Deleted all custom fields.' );
			}
		} else {
			$success = $this->delete_metadata( $object_id, $meta_key, $meta_value );
			if ( $success ) {
				WP_CLI::success( 'Deleted custom field.' );
			} else {
				WP_CLI::error( 'Failed to delete custom field.' );
			}
		}
	}
public function delete( $args, $assoc_args ) {
		list( $object_id ) = $args;

		$meta_key   = ! empty( $args[1] ) ? $args[1] : '';
		$meta_value = ! empty( $args[2] ) ? $args[2] : '';

		if ( empty( $meta_key ) && ! Utils\get_flag_value( $assoc_args, 'all' ) ) {
			WP_CLI::error( 'Please specify a meta key, or use the --all flag.' );
		}

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

		if ( Utils\get_flag_value( $assoc_args, 'all' ) ) {
			$errors = false;
			foreach ( $this->get_metadata( $object_id ) as $meta_key => $values ) {
				$success = $this->delete_metadata( $object_id, $meta_key );
				if ( $success ) {
					WP_CLI::log( "Deleted '{$meta_key}' custom field." );
				} else {
					WP_CLI::warning( "Failed to delete '{$meta_key}' custom field." );
					$errors = true;
				}
			}
			if ( $errors ) {
				WP_CLI::error( 'Failed to delete all custom fields.' );
			} else {
				WP_CLI::success( 'Deleted all custom fields.' );
			}
		} else {
			$success = $this->delete_metadata( $object_id, $meta_key, $meta_value );
			if ( $success ) {
				WP_CLI::success( 'Deleted custom field.' );
			} else {
				WP_CLI::error( 'Failed to delete custom field.' );
			}
		}
	}
public function delete ( $ args , $ assoc_args ) { list ( $ object_id ) = $ args ; $ meta_key = ! empty ( $ args [ 1 ] ) ? $ args [ 1 ] : '' ; $ meta_value = ! empty ( $ args [ 2 ] ) ? $ args [ 2 ] : '' ; if ( empty ( $ meta_key ) && ! Utils \ get_flag_value ( $ assoc_args , 'all' ) ) { WP_CLI :: error ( 'Please specify a meta key, or use the --all flag.' ) ; } $ object_id = $ this -> check_object_id ( $ object_id ) ; if ( Utils \ get_flag_value ( $ assoc_args , 'all' ) ) { $ errors = false ; foreach ( $ this -> get_metadata ( $ object_id ) as $ meta_key => $ values ) { $ success = $ this -> delete_metadata ( $ object_id , $ meta_key ) ; if ( $ success ) { WP_CLI :: log ( "Deleted '{$meta_key}' custom field." ) ; } else { WP_CLI :: warning ( "Failed to delete '{$meta_key}' custom field." ) ; $ errors = true ; } } if ( $ errors ) { WP_CLI :: error ( 'Failed to delete all custom fields.' ) ; } else { WP_CLI :: success ( 'Deleted all custom fields.' ) ; } } else { $ success = $ this -> delete_metadata ( $ object_id , $ meta_key , $ meta_value ) ; if ( $ success ) { WP_CLI :: success ( 'Deleted custom field.' ) ; } else { WP_CLI :: error ( 'Failed to delete custom field.' ) ; } } }
Delete a meta field.

## OPTIONS

<id>
: The ID of the object.

[<key>]
: The name of the meta field to delete.

[<value>]
: The value to delete. If omitted, all rows with key will deleted.

[--all]
: Delete all meta for the object.
Delete a meta field .