Drupal8

How to delete Drupal menu item programmatically

How-to-Delete-Drupal-Menu

Sometimes we need to delete the menu item programmatically, so the below code snippet will help you to delete any menu item programmatically. You need to pass the menu id to the entityTypeManager service and you need to call the delete method. $menu_link = \Drupal::entityTypeManager()->getStorage(‘menu_link_content’)->load(3); // Pass Menu Id $menu_link->delete();  

How to delete Drupal menu item programmatically Read More »