I need to work over the hook_menu_alter function and I found that the dpm() function is not working for arrays. I have devel and admin_devel enabled. I flushed all cache to make sure the hook is fired.

function MY_MODULE_menu_alter(&$items) {
  dpm('hello'); // This is printed 
  dpm($items); //This one is not printed at all
  • Try the drupal_debug function which writes to a txt file in your tmp directory. api.drupal.org/api/devel/devel.module/function/drupal_debug/7
    – 2pha
    Feb 6, 2013 at 9:22
  • 1
    FYI the exact same code works for me so the problem is with your site in particular...have you tried turning off other modules to see if you can isolate the cause of the problem?
    – Clive
    Feb 6, 2013 at 9:40
  • I have a setup where I get Array(), slightly better than nothing but not by much.
    – the
    Aug 29, 2014 at 9:50

1 Answer 1


hook_menu_alter() is fired directly in the same call that flushes the caches - and only once. If you do that via drush cc all the result is never displayed.

  • 2
    This doesn't explain why "hello" is printed, but not the array.
    – apaderno
    Feb 6, 2013 at 10:33
  • In fact dpm($items) works if I run cron.
    – chefnelone
    Feb 6, 2013 at 10:59
  • IMHO cron also empties caches. - where/when does it print "hello"? Feb 6, 2013 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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