Unable to create Menu Item I am creating a menu item using the following code.

$item = array(
'link_path' =&gt; 'node/custom',
'link_title' =&gt; 'Custom Title 001',
'menu_name' =&gt; 'menu-custom-menu', // Menu machine name, for example: main-menu
'weight' =&gt; 0,
'plid' =&gt; 0, // Parent menu item, 0 if menu item is on top level
'module' =&gt; 'menu',
);
menu_link_save($item);


I can see the entries is menu_links table, but can not see this menu item under the menu at 'admin/structure/menu/manage/menu-custom-menu'. What is wrong with my code?

Please note this path('node/custom' actually doesn't exist in Drupal System.
Please note this path('node/custom') actually doesn't exist in Drupal System.

Whenever we create using admin a menu it asks for a valid path otherwise it shows error of Url doesn't exist. So probably it enters the data in database directly but will not be listed in the admin unless it has a valid path assigned.

Please try by adding a page, e.g node/1 to the path and then try. 

$item = array(
'link_path' =&gt; 'node/1',
'link_title' =&gt; 'Custom Title 001',
'menu_name' =&gt; 'menu-custom-menu', // Menu machine name, for example: main-menu
'weight' =&gt; 0,
'plid' =&gt; 0, // Parent menu item, 0 if menu item is on top level
'module' =&gt; 'menu',
);
menu_link_save($item);


and make sure node/1 exists in the system.

Hope it will help you.