How to Create and Delete Menus Using WP-CLI Updated on November 19, 2021 by InMotion Hosting Contributor 2 Minutes, 1 Seconds to Read WordPress Hosting by InMotion Hosting includes WordPress Command Line Interface (WP-CLI). This convenient tool allows you to work on your WordPress website(s) directly from the command line. Once you are familiar with the syntax and available commands, you will be able to quickly modify common elements of your website(s), like menus. Menus are essential for providing a focal point for your visitors to locate important information contained within your website. In this guide, you will learn how to create and delete a menu with WP-CLI, using the command wp menu. Create a New Menu Creating a new menu is simple using the sub-command wp menu create. The steps below will guide you through the process of creating a new menu from the command line, using WP-CLI. SSH into your server as the cPanel user that owns the website you would like to work with. Use the cd command to switch to the document root directory of your website. Example: cd public_html/wp NOTE: Be sure to replace public_html/wp with the actual path to the document root directory of your website. Run the following command: wp menu create primary-nav NOTE: Be sure to replace primary-nav with the actual name you would like to give to the menu you are creating. The output will be similar to the example below: [email protected] [~/public_html/wp]# wp menu create primary-nav Success: Created menu 3. Delete a Menu If you are unsatisfied with a menu you have created, you can remove it by using the wp menu delete sub-command. The following steps will guide you through the process of deleting a menu via the command line, using WP-CLI. SSH into your server as the cPanel user that owns the website you would like to work with. Use the cd command to switch to the document root directory of your website. Example: cd public_html/wp NOTE: Be sure to replace public_html/wp with the actual path to the document root directory of your website. Run the following command: wp menu delete primary-nav NOTE: Be sure to replace primary-nav with the actual name of the menu you are deleting. The output will be similar to the following example: [email protected] [~/public_html/wp]# wp menu delete primary-nav Success: Menu(s) deleted. Congratulations! Now, you know how to create and delete menus from your WordPress website via the command line using WP-CLI. Learn more about WP-CLI, the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows! Share this Article IC InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Install and Configure WP-CLI How to Create and Delete a WordPress Page Using WP-CLI Install a Theme Using WP-CLI Install WordPress Using WP-CLI Manage WordPress Comments Using WP-CLI Update WordPress Using WP-CLI Manage WordPress Users Using WP-CLI WP-CLI search-replace Command Delete WordPress Transients Using WP-CLI Manage WordPress Plugins with WP-CLI