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.
Exibir arquivo
Open project: wp-cli/wp-cli
Protected Properties
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 Details
## 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 ) |
## OPTIONS
## 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
$obj_type protected_oe property