Why is a menu item from hook_menu not accessible?
- Is your module enabled?
- Whenever you make a change to your module's hook_menu implementation, you need to rebuild the router table by visiting
admin/build/modules
. The Devel module provides a block that has a menu rebuild shortcut. - Does you hook_menu implementation return the menu item array?
- Is your hook_menu properly named as modulename_menu?
- Carefully check whether the array keys you use are correct. A common mistake is the use of
'page_callback'
instead of the correct'page callback'
. - Check what access callback and access arguments are used.
- Make sure that your hook_menu implementation is in the .module file, not an include file.
Comments
Thanks
Submitted by kacz (not verified) on Thu, 2010/05/06 - 19:48Even after two years of drupal development, this one bit me in the ass recently. Being stubborn I took an hour to try to figure it out on my own before giving in to google.
One would think Drupal would present some sort of error when trying to load a module with a menu hook misnamed...
thanks again
Thank you
Submitted by Allison Christiansen (not verified) on Wed, 2010/05/12 - 21:06I am pretty new to drupal and I did not realize you had to go to admin/build/modules for it to start working. Any time I go to that page though, Apache crashes, but apparently it still worked. So thanks again :)