How to add a menu item to main menu: hook_menu() or menu_link_save()? I just want to programmatically add some menu items to the main menu, but none of the answers I found worked. Some answers suggest using hook_menu(), others suggest using menu_link_save(). I followed what reported in Can I add a custom link to &quot;Main Menu&quot; via hook_menu? but it just doesn't work. There's no new item added, neither in the UI nor in the database.

function mymodule_menu() {
  $items['my/path'] = array(
    'title' =&gt; 'Title',
    'page callback' =&gt; 'page_creator_function',
    'access callback' =&gt; TRUE,
    'menu_name' =&gt; 'main-menu',
    'type' =&gt; MENU_NORMAL_ITEM,
  );

  return $items;
}


Also I found How and where do I programmatically add a menu to the Navigation menu?. Answer #2 says that using menu_link_save() is the way to go, but I could not get it to work. Do I have to place the code in a certain location or a special hook?

$item = array(
  'link_path' =&gt; 'my_path',
  'link_title' =&gt; 'Title',
  'menu_name' =&gt; 'main-menu', 
  'weight' =&gt; 0,
  'language' =&gt; 'en',
  'plid' =&gt; 0,
  'module' =&gt; 'menu',
);
menu_link_save($item);


Since both answers didn't work out, it seems that I am missing a crucial point. Could anyone say what's going on here?
After a hard time I figured out what hampered the execution of the above code: clearing caches isn't enough to see the results. I had to use devels menu reset (/devel/menu/reset). Using drush's drush eval 'menu_rebuild();' as mentioned at How do I call the menu_rebuild function in Drupal 7? somehow does not work. I do not know why.