I was wondering if there's any way to find out what modules are adding links to what menus using hook_menu()? I don't care if it's a module or custom code added to Drupal core, I just need to know. There's a link showing up in my main menu and I have no idea what's putting it there. I'd really rather not go through every single module and check their menu hooks.

3 Answers 3


To find a particular menu entry, search the menu_router table for the path or something that matches the path if arguments are used, and then use a hook_menu_alter to print the menu item to debug:

function mymodule_menu_alter (&$items)

Then look at the page callback index. If will contain a string with the function name that gets called for that menu item (see hook_menu for more details). In general, the callback function will closely match the module name. For example, if the callback is "foo_bar_generate_a_page" then the "foo" or "foo_bar" module owns that menu entry.


You're after module_implements(). It will allow you to specify the hook (in this case 'menu') and then get an array of module names back.
Of course, you'll still need to manually open the files to check, but you should be able to narrow it down from the menu path and title.

It might be worth flushing the caches too.

  • The main problem with module_implements for chasing down a menu router entry is that just about every module (or at least a large majority) implements hook_menu for settings pages. You end up having to examine just about every module anyway.
    – mpdonadio
    Dec 17, 2011 at 21:05

Most text editors (notepad++, sublime text, textmate, etc) have "Find in files" functionality that you can use to search your entire Drupal codebase. Just put in the path you're curious about (e.g., user/login or admin/appearance) and point it to your sites/all/modules folder and it should point out exactly what module's hook_menu is responsible.

If it doesn't find anything, make sure you're not searching for a menu that has arguments. If I wanted to know what module is responsible for node/add/page I would need to make sure to leave off /page since that won't be hardcoded in any hook_menu.

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.