Make Hook in main-menu I created a module containing the following files:


menu_imoveis.info
menu_imoveis.module


The content of menu_imoveis.info is the following.


    name = Menu Imoveis
    description = Adiciona imoveis ao menu.
    package = Imoveis
    core = 7.x
    version = 7.x-dev

    files[] = menu_imoveis.module


**The content of menu_imoveis.module is the following.

function menu_imoveis_menu() {
  $items['node/27'] = array(
    'title' =&gt; 'Example Page',
    'menu_name' =&gt; 'main-menu',
    'type' =&gt; MENU_NORMAL_ITEM,
  );

  return $items;
}


The code I wrote doesn't work.
Taken from this comment, written by zifiniti:


  I was having trouble getting a menu item to display with the following code:

function mymodule_menu() {
  $items['custom-page'] = array(
    'title' =&gt; 'Custom Page',
    'menu_name' =&gt; 'main-menu',
    'access arguments' =&gt; array('access custom pages')
  );

  return $items;
}

  
  It was continuously denying me access to the specified path in addition to not displaying the item in the menu. I discovered that the reason behind this is if you do not specify a page callback, then the access callback will acquire a value of 0 in the database and thus render that path/menu item inaccessible.
  
  Working code:

function mymodule_menu() {
  $items['custom-page'] = array(
    'title' =&gt; 'Custom Page',
    'menu_name' =&gt; 'main-menu',
    'page callback' =&gt; 'mymodule_custom_page',
    'access arguments' =&gt; array('access custom pages')
  );
}