We have a small D7 site. We want to deactivate a main menu item. On dev server I was able to deactivate it in /admin/structure/menu/manage/main-menu

I believe The menu is stored in the DB, right. Also in a config file? So you only need to deploy those two things and it is done.

Is that correct? If not, what are the steps to deploy a main menu change?

  • Log in to your live site and do the same. Menu items are entities same as nodes, taxonomy terms, users. So you need to do that from the UI or write a custom module update hook to do that programmatically (then deploy the module and trigger database updates).
    – leymannx
    Commented Nov 13, 2019 at 14:22
  • Look into using the Features module.
    – No Sssweat
    Commented Nov 13, 2019 at 14:24
  • Update hook is the proper way handling these types of things. See jDrupal's answer below Commented Nov 13, 2019 at 20:03

3 Answers 3


Menu items are saved in the DB, therefore you must update them using update hooks.

Something like this should work:

function MODULE_NAME_update_N() {
  $menu_link_id = 1;
  $menu_link = menu_link_load($menu_link_id);
  $menu_link['hidden'] = 0;
  • 1
    Make sure you follow the constructs described here: drupal.org/docs/7/creating-custom-modules/howtos/… Commented Nov 13, 2019 at 20:02
  • Would they actually have same ids across environments?
    – anoopjohn
    Commented Nov 14, 2019 at 2:11
  • @anoopjohn assuming you pulled the latest live DB to your local/dev before making the change, yes.
    – No Sssweat
    Commented Nov 14, 2019 at 6:18
  • Thanks for the reply. I was wondering if that would always be the case even if you start with the same database copy.
    – anoopjohn
    Commented Nov 14, 2019 at 6:42
  • Yes I think so, normally you create content on prod and then use the prod DB on dev so that way the IDs would be the same.
    – user72672
    Commented Nov 14, 2019 at 7:05

You can use Features Module.

  1. Create another feature for menus. enter image description here
  2. Push your new module to your server.
  3. Enabled it in the new server.

    drush en your_feature

  4. Revert your feature

    drush fr your_feature


Menu items are stored in the database.

You are still able to export the menu using a contrib module.

For Drupal 7

You can achieve that by using Menu Export/Import contrib module.

For Drupal 8 & 9

You can achieve that by using Menu Import and Export. The module will give you the ability to exports the menu entity as config YAML and will be imported on subsequent instances.

  • Unfortunately that module is only available for Drupal 8, OP is asking for a Drupal 7 solution.
    – user72672
    Commented Nov 14, 2019 at 9:22
  • I update the answer for D7, I used to do that with feature module, but I don't remember if that was feature module or feature extra module
    – Ziftman
    Commented Nov 14, 2019 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.