Drupal

How to delete Drupal menu item programmatically

Drupal Menu Delete

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();  

Pin It on Pinterest