From what hooks (or "types" of hooks) is it appropriate to call menu_link_save?

I have a situation where I would like to add a bunch of entries to {menu_links} where an entry already exists in {menu_router}. To state this another way, I would like to add direct links to a menu for which another module has defined a wildcard entry via hook_menu.

A concrete example would be that I would like to add a menu item to a menu for "taxonomy/term/123". In this case, there is already a router entry for "taxonomy/term/%" which the taxonomy module created.

I know how to use this function. I am just not sure where I can (or should) call this from. This isn't a situation where a user is saving a node, or something else that would be considered an event. Essentially, I just want my module to create a bunch of links so the end user doesn't have to.

Would this be best done by a hook_enable? Are there any popular modules that I can take a look at for examples / use cases?

1 Answer 1


Yes, hook_enable() sounds correct.

To find examples, on way is look at what's using the function on drupalcontrib.org. That points to menu_enable(), which is even a core function.

  • Thanks. I was hoping to find more examples, but this does seem proper. I ended up doing this, and also adding an admin menu entry to check/rebuild the additions for when things get messed up.
    – mpdonadio
    Commented Jan 3, 2012 at 21:03

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.