4

I just deleted 25 menu items and it took me some time to do it.

Just wondering if is there any way (module) to bulk delete menu items.

3

Try Menu Editor module

Menu Editor enhances the menu editing form with inline text fields for title, path and description, and provides placeholders for new items.

  • Perfect, just what I was looking for. – chefnelone Feb 20 '13 at 7:43
2

Confirmed! Menu Editor Module lets you multi-select menu items to delete, as well as some other cool functions.

1

Just an addition, Menu Editor won't delete the links which are being generated by other modules, such as taxonomy menu etc. In order to delete those links, you ll have to refer to the concerned module.

0

You can do a bulk delete directly from the database.

Just delete the items in menu_links table that you need.

Take in consideration these fields: menu_name: The name of your menu mlid: Internal menu id item plid: Parent id menu item. This field is distinct to 0 if the menu item has a parent weight: The weight is the field for ordering the menu items depth: This is the depth of the menu item

Example: Delete all the menu items of the main menu where the depth is greater than 2 and the parent id is not 597.

DELETE 
FROM yourDatabaseName.menu_links
WHERE menu_name LIKE 'main-menu'
AND depth > 2
AND plid != 597
0

Not a module sollution, but this helps getting this update trough OTAP.

You could also do this in a hook_update_n

Hide all module items where parent id = 5947, including the parent item itself. Of course delete works as well, but I find it a nice solution to disable the menu items.

Look in the database menu_links table for the fields to make a condition on.

/**
 * Hide old menu item.
 */
function module_name_update_7000() {
  db_update('menu_links')
    ->fields(array('hidden' => '1'))
    ->condition('menu_name', 'main-menu', '=')
    ->condition('p1', '5947', '=')
    ->execute();

  drupal_flush_all_caches();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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