wp menu <command>

Lists, creates, assigns, and deletes the active theme’s navigation menus.

In this article

See the Navigation Menus reference in the Theme Handbook.

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 primary to menu my-menu.

Subcommands

NameDescription
wp menu create

Creates a new menu.

wp menu delete

Deletes one or more menus.

wp menu item

List, add, and delete items associated with a menu.

wp menu list

Gets a list of menus.

wp menu location

Assigns, removes, and lists a menu’s locations.

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.