Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I try to remove a nav menu programmatically but I didn't find the way to do it. I knwo how to create it but I don't know how to delete it... I've got the menu name and I wan't to delete it like in wp admin panel but programmatically.

Or I want to delete all the menu item inside it.

share|improve this question
    
Just delete it from admin. –  Brad Dalton Jul 20 at 16:29
    
programmatically –  lolo Jul 20 at 20:03
    
possible duplicate of Unregister Nav Menu with fallback? –  Brad Dalton Jul 20 at 20:33
    
I just try but it's not working in my case. In fact I want to completely delete the nav menu or item inside the nav menu then repopulate it... What wordpress do when you click on delete menu? –  lolo Jul 20 at 21:10

1 Answer 1

Finally the answer is simple:

$menu_name   = 'your menu';//name,id,slug
wp_delete_nav_menu($menu_name);
share|improve this answer

Your Answer

 
discard

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.