Programmatically delete a menu and all contained links in Drupal 7

Last updated on 26/05/2015

The following code snippet will delete completely your custom menu and all contained links.

  foreach (menu_get_menus(FALSE) as $menu => $menu_title) {
    if ($menu == 'menu-my-menu_name') {
      $menu = menu_load($menu);
      menu_delete($menu);
    }
  }