diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c02e4f7..bbf5c43 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2701,10 +2701,11 @@ function menu_link_rebuild_defaults() { } } - // Find any item whose router path does not exist any more. + // Find any item whose entry in hook_menu_link_defaults() no longer exists. if ($all_links) { $query = \Drupal::entityQuery('menu_link') ->condition('machine_name', array_keys($all_links), 'NOT IN') + ->condition('machine_name', NULL, '<>') ->condition('external', 0) ->condition('updated', 0) ->condition('customized', 0) @@ -2717,7 +2718,7 @@ function menu_link_rebuild_defaults() { // Remove all such items. Starting from those with the greatest depth will // minimize the amount of re-parenting done by the menu link controller. - if (!empty($result)) { + if ($result) { menu_link_delete_multiple($result, TRUE); } }