PHP Class Menu_Command, wp-cli

## EXAMPLES # Create a new menu $ wp menu create "My Menu" Success: Created menu 200. # List existing menus $ wp menu list +---------+----------+----------+-----------+-------+ | term_id | name | slug | locations | count | +---------+----------+----------+-----------+-------+ | 200 | My Menu | my-menu | | 0 | | 177 | Top Menu | top-menu | primary | 7 | +---------+----------+----------+-----------+-------+ # Create a new menu link item $ wp menu item add-custom my-menu Apple http://apple.com --porcelain 1922 # Assign the 'my-menu' menu to the 'primary' location $ wp menu location assign my-menu primary Success: Assigned location to menu.
Inheritance: extends WP_CLI_Command
显示文件 Open project: wp-cli/wp-cli

Protected Properties

Property Type Description
$obj_fields
$obj_type

Public Methods

Method Description
create ( $args, $assoc_args ) Create a new menu.
delete ( $args, $_ ) Delete one or more menus.
list_ ( $_, $assoc_args ) Get a list of menus.

Protected Methods

Method Description
get_formatter ( &$assoc_args )

Method Details

create() public method

## OPTIONS : A descriptive name for the menu. [--porcelain] : Output just the new menu id. ## EXAMPLES $ wp menu create "My Menu" Success: Created menu 200.
public create ( $args, $assoc_args )

delete() public method

## OPTIONS ... : The name, slug, or term ID for the menu(s). ## EXAMPLES $ wp menu delete "My Menu" Success: 1 menu deleted.
public delete ( $args, $_ )

get_formatter() protected method

protected get_formatter ( &$assoc_args )

list_() public method

## OPTIONS [--fields=] : Limit the output to specific object fields. [--format=] : Render output in a particular format. --- default: table options: - table - csv - json - count - ids - yaml --- ## AVAILABLE FIELDS These fields will be displayed by default for each menu: * term_id * name * slug * count These fields are optionally available: * term_group * term_taxonomy_id * taxonomy * description * parent * locations ## EXAMPLES $ wp menu list +---------+----------+----------+-----------+-------+ | term_id | name | slug | locations | count | +---------+----------+----------+-----------+-------+ | 200 | My Menu | my-menu | | 0 | | 177 | Top Menu | top-menu | primary | 7 | +---------+----------+----------+-----------+-------+
public list_ ( $_, $assoc_args )

Property Details

$obj_fields protected_oe property

protected $obj_fields

$obj_type protected_oe property

protected $obj_type