I need to edit the hook_menu function in my module. I need to add a new link to a menu, and edit the path for an existing link. Is this possible without creating a whole new module?

The only example in the docs for when hook_menu runs is when the module is enabled. Is there any other time it runs?

  • hook_menu(), together hook_menu_alter(), is invoked when menu definitions needs to be rebuild, which normally happens when any module is installed, removed, enabled, or disabled. The question is a little unclear, though. What do you mean by I need to edit the hook_menu() function in my module? Disable the module, edit the code, and re-enable the module. – kiamlaluno Oct 8 '18 at 20:29

Clearing the cache the menu and routing tables will be reconstructed.

In the admin UI, go to:


Using drush:

drush cache-clear all

Other methods are described here: How do I call the menu_rebuild function in Drupal 7?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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