PHP Class WP_CLI\CommandWithMeta

Inheritance: extends WP_CLI_Command
显示文件 Open project: wp-cli/wp-cli Class Usage Examples

Protected Properties

Property Type Description
$meta_type

Public Methods

Method Description
add ( $args, $assoc_args ) Add a meta field.
delete ( $args, $assoc_args ) Delete a meta field.
get ( $args, $assoc_args ) Get meta field value.
list_ ( $args, $assoc_args ) List all metadata associated with an object.
update ( $args, $assoc_args ) Update a meta field.

Protected Methods

Method Description
check_object_id ( $object_id ) Check that the object ID exists

Private Methods

Method Description
get_fields ( ) : array Get the fields for this object's meta

Method Details

add() public method

## OPTIONS : The ID of the object. : The name of the meta field to create. [] : The value of the meta field. If omitted, the value is read from STDIN. [--format=] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---
public add ( $args, $assoc_args )

check_object_id() protected method

Check that the object ID exists
protected check_object_id ( $object_id )

delete() public method

: The ID of the object. [] : The name of the meta field to delete. [] : The value to delete. If omitted, all rows with key will deleted. [--all] : Delete all meta for the object.
public delete ( $args, $assoc_args )

get() public method

: The ID of the object. : The name of the meta field to get. [--format=] : Accepted values: table, json. Default: table
public get ( $args, $assoc_args )

list_() public method

: ID for the object. [--keys=] : Limit output to metadata of specific keys. [--fields=] : Limit the output to specific row fields. Defaults to id,meta_key,meta_value. [--format=] : Accepted values: table, csv, json, count. Default: table
public list_ ( $args, $assoc_args )

update() public method

## OPTIONS : The ID of the object. : The name of the meta field to update. [] : The new value. If omitted, the value is read from STDIN. [--format=] : The serialization format for the value. --- default: plaintext options: - plaintext - json ---
public update ( $args, $assoc_args )

Property Details

$meta_type protected_oe property

protected $meta_type