I have added a menu item in main-menu using following code

$item = array(
    'menu_name' => 'main-menu',
    'link_path' => 'my-profile',
    'link_title' => 'Services',
    'module' => 'menu',
    'weight' => 0,

this code is placed in lcp_theme function, lcp is custom module and is working properly except this added menu item. I cant see this menu at top of the site in main menu.

As per the documentation I can use this function anywhere in module.


If all you are trying is to add a menu item in main menu, you can implement hook_menu, code something as below.

function my_module_name_menu() {
  $items['test'] = array(
    'title'           => 'Tes Page',
    'description'     => t('Test'),
    'menu_name'       => 'main-menu',
    'weight'          => 8,
    'access callback' => TRUE,
    'page callback'   => '_my_module_name_test_page',
    'type' => MENU_NORMAL_ITEM,

  return $items;

function _my_module_name_test_page() {
  return "hi";

Key is to have 'menu_name' => 'main-menu', in menu item declaration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.