PHP Class WP_CLI\CommandWithTerms

Inheritance: extends WP_CLI_Command
Show file Open project: wp-cli/wp-cli

Protected Properties

Property Type Description
$obj_fields array Default fields to display for each object.
$obj_id string
$obj_type string

Public Methods

Method Description
add ( $args, $assoc_args ) Add a term to an object.
list_ ( $args, $assoc_args ) List all terms associated with an object.
remove ( $args, $assoc_args ) Remove a term from an object.
set ( $args, $assoc_args ) Set object terms.

Protected Methods

Method Description
get_formatter ( array &$assoc_args ) : Formatter Get Formatter object based on supplied parameters.
get_obj_id ( ) : string Get obj_id Class variable
get_object_type ( ) : string Get obj_type Class variable
set_obj_id ( string $obj_id ) Set obj_id Class variable
taxonomy_exists ( $taxonomy ) Check if taxonomy exists

Method Details

add() public method

Append the term to the existing set of terms on the object. : The ID of the object. : The name of the taxonomy type to be added. ... : The slug of the term or terms to be added.
public add ( $args, $assoc_args )

get_formatter() protected method

Get Formatter object based on supplied parameters.
protected get_formatter ( array &$assoc_args ) : Formatter
$assoc_args array Parameters passed to command. Determines formatting.
return Formatter

get_obj_id() protected method

Get obj_id Class variable
protected get_obj_id ( ) : string
return string

get_object_type() protected method

Get obj_type Class variable
protected get_object_type ( ) : string
return string $obj_type

list_() public method

: ID for the object. ... : One or more taxonomies to list. [--fields=] : Limit the output to specific row fields. [--format=] : Accepted values: table, csv, json, count, ids. Default: table ## AVAILABLE FIELDS These fields will be displayed by default for each term: * term_id * name * slug * taxonomy These fields are optionally available: * term_taxonomy_id * description * term_group * parent * count
public list_ ( $args, $assoc_args )

remove() public method

: The ID of the object. : The name of the term's taxonomy. ... : The name of the term or terms to be removed from the object.
public remove ( $args, $assoc_args )

set() public method

Replaces existing terms on the object. : The ID of the object. : The name of the taxonomy type to be updated. ... : The slug of the term or terms to be updated.
public set ( $args, $assoc_args )

set_obj_id() protected method

Set obj_id Class variable
protected set_obj_id ( string $obj_id )
$obj_id string

taxonomy_exists() protected method

Check if taxonomy exists
protected taxonomy_exists ( $taxonomy )
$taxonomy

Property Details

$obj_fields protected property

Default fields to display for each object.
protected array $obj_fields
return array

$obj_id protected property

protected string $obj_id
return string

$obj_type protected property

protected string $obj_type
return string