Wp menu (WP-CLI)
Naar navigatie springen
Naar zoeken springen
wp menu: Werk met menu's en menu-items. Dit laatste gaan via het subcommando wp menu item
$ wp help menu NAME wp menu DESCRIPTION Lists, creates, assigns, and deletes the active theme's navigation menus. SYNOPSIS wp menu <command> SUBCOMMANDS create Creates a new menu. delete Deletes one or more menus. item List, add, and delete items associated with a menu. list Gets a list of menus. location Assigns, removes, and lists a menu's locations. See the [Navigation Menus][1] reference in the Theme Handbook. --- [1] https://developer.wordpress.org/themes/functionality/navigation-menus/ 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.