I am implementing the following in a module:

function foo_module_menu() {

    $items['taxonomy/term/%'] = array(
    'page callback' => 'subproducts_populate_taxo',
   'page arguments' => array(1),
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK);

    return $items;

This hook doesn't seem to work, i assumed it was because of the taxonomy module having prevalence on this menu item, so i gave my module a -1 weight.

Now strange thing, it work but only after clear cache once after applying the weight change. If i reflush cache the Taxonomy module take prevalence again even though i didn't rechange the weight..

Any ideas ?

2 Answers 2


Use hook_menu_alter() to override existing menu entries.

  • Actually your solution seems better, according to my menu hook, will that code work ? hook_menu_alter(&$items) { $items['taxonomy/term/%']['page callback'] = 'subproducts_populate_taxo'; [....] }
    – silkAdmin
    Oct 6, 2011 at 15:55
  • Yes, something like that.
    – Berdir
    Oct 6, 2011 at 18:44

Thanks your suggestion, it ll probably come in handy later, though in the mean time i got it working by making the weight of my module lighter than the taxonomy. Seems that to override menu items lighter module get prevalence.

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.