Way to bulk delete menu items in new 3.x Appearance > Menus system?

I’ve done some searches but maybe I’m searching on the wrong terms. Does anyone know if there’s a way to bulk-delete menu items in the new Appearance > Menus system? This is mostly to clean up localhost installations, so I’m totally open to plugins if anyone knows of one. I’d be thrilled if I could delete a Page and have all its sub pages (the ones I set as its sub pages via the Menu, not necessarily its real Child pages) also disappear from the menu, for instance.

Thanks for any help!

Related posts

Leave a Reply

6 comments

  1. I had to do this too, but didn’t find a quick and easy way. Since jQuery is available in the wp admin, I used that to select all the delete links and trigger the click event on them:

    jQuery('#menu-to-edit')
        .find('.submitdelete')
        .trigger('click');
    
  2. There isn’t a way to do a bulk delete. Instead, you should just create a new menu with your updated items.

    The menu system is meant to be an easy-to-use, configure-once, drag-and-drop interface. There’s no bulk delete because, really, very few people would ever need it and such a feature would likely clutter the interface.

  3. Though I’ve looked, I have never figured out a way to bulk-delete child pages that were set by hand in the new Menu system. But, I have figured out how to auto-add child page via one of these two plugins:

    If the child pages are auto-added via one of these plugins, I believe they call all be deleted simply by removing the parent page item or disabling the auto-add pages.

    Hope this helps someone else who’s struggling with managing large numbers of menu items (especially after the import process duplicates all of them!).

  4. being I was searching for the answer to the same question and this is the first link in search results I decided to post my solution here.

    There is a plugin called “Quick remove menu item” that will help with deleting menu items faster. It hasn’t been updated in 2 years but it still works with the latest version of wordpress.

  5. This jQuery answer worked and Quickly! But it delete all items.

    if you need to clarify the items to be deleted, then you need to add some conditions. For example, delete all items with “URL” value “#” (usually these are incorrect items left after deleting pages, categories, etc.)

    jQuery('#menu-to-edit li.menu-item:has(input[value="#"])')
     .find('.submitdelete')
     .trigger('click');
    
    
  6. I was looking for the same thing, and the answers here didn’t really work for me because I really needed to remove a complete sub menu, children incuded.

    First, you will need the ID of the parent page, but if you can use jQuery, you probably won’t have any trouble with that 🙂

    Then use this two-liner, replacing 100 with your ID :

    jQuery('#menu-item-100').find('.submitdelete').trigger('click');
    jQuery('.menu-item-data-parent-id[value=100]').parent().find('.submitdelete').trigger('click');