Drupal Logo

hook_menu path not working in Drupal (6,7)

Right From Drupal website :

This hook enables modules to register paths in order to define how URL requests are handled. Paths may be registered for URL handling only, or they can register a link to be placed in a menu (usually the Navigation menu). A path and its associated information is commonly called a “menu router item”. This hook is rarely called (for example, when modules are enabled), and its results are cached in the database.

Suppose we defined a custom a wildcard menu path as shown below

[sourcecode language=”php”]$items[‘my-module/%mymodule_abc/edit’] = array(
‘page callback’ => ‘mymodule_abc_edit’,
‘page arguments’ => array(1),


When path ‘my-module/123/edit’ is requested, your load function mymodule_abc_load() will be invoked with the argument ‘123’, and should load and return an “abc” object with internal id 123:

[sourcecode language=”php”]function mymodule_abc_load($abc_id) {
return db_query(“SELECT * FROM {mymodule_abc} WHERE abc_id = :abc_id”, array(‘:abc_id’ => $abc_id))->fetchObject();


This ‘abc’ object will then be passed into the callback functions defined for the menu item, such as the page callback function mymodule_abc_edit() to replace the integer 1 in the argument array.

For more information please visit actual source for this article
Drupal hook_menu article