WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that each menu item is simply post present in nav_menu_item post type. It has has ID and can be removed with wp_delete_post() but posts deleted this way don't remove menus present under [Appearance > Menus]. Only menu items are removed.

For instance I have "My Menu" under [Appearance > Menus] that has the following items: page-1, page-2, category-3. I can remove menu items with wp_delete_post() but "My Menu" (group for those items) remains intact.

How can I programatically remove all defined Menus (and menu items)?

share|improve this question
It’s quite easy to interpret this question in many different ways. Any chance of posting a screenshot of what you’re trying to accomplish? – Cor van Noorloos Dec 16 '12 at 13:15
I added example. Basically, under [Appearance > Menus] I can create menu that has items. Items can be removed with wp_delete_post() but this doesn't remove "Menu Group" that they were in. – Paul Dec 16 '12 at 16:08
up vote 0 down vote accepted

Please check wp_delete_nav_menu() function. If you want to get all nav menus you can check wp_terms table or

$menu_list = get_terms('nav_menu');

to get a list of it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.