Programmatically disabling menu item
You can retrieve the Drupal menu link &amp; cache services to programmatically change the menu link status. Something like this example function:

function menu_state_toggle($menu_id, $enabled = TRUE) {
  $menu_link_manager = \Drupal::service('plugin.manager.menu.link');
  $front_page_link = $menu_link_manager-&gt;getDefinition($menu_id);
  $front_page_link['enabled'] = $enabled ? 1 : 0; 
  $menu_link_manager-&gt;updateDefinition($menu_id, $front_page_link);
  $cache = \Drupal::cache('menu');
  $cache-&gt;deleteAll();
}

menu_state_toggle('standard.front_page', FALSE);