I'm trying to build an intall profile that implements a number if features. I am running into some issues because although features allows me to require menus, it seems there is no way to also include the links (most of the link are simple aliases to add content or edit views). Is there a way to add menu items from within the install profile?

1 Answer 1


You can follow the example from the profiles/standard/standard.install file and use code like this inside your implementation of hook_install():

// Create a Home link in the main menu.
$item = array(
  'link_title' => st('Home'),
  'link_path' => '<front>',
  'menu_name' => 'main-menu',
  • Thanks! what if the menu is hierarchical, for instance I have a menu the has an events link, and under the events link is an add events link
    – user379468
    Jan 18, 2013 at 18:42
  • You can pass plid as the parent link ID in your $item, so save 'Events' first, then save Add Events with a plid of the first item's mlid (menu link id, it's returned from menu_link_save())
    – Clive
    Jan 18, 2013 at 18:46

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.