WP-CLI

A command line interface for WordPress

Commands » menu

wp menu - List, create, assign, and delete menus.

Quick links: Github issues


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.

SUBCOMMANDS

Name Description
create Create a new menu.
delete Delete one or more menus.
item List, add, and delete items associated with a menu.
list Get a list of menus.
location Manage a menu's assignment to locations.