I have the following code in my hook_menu_alter().


function bonus_menu_alter(&$items) {

  if (!empty($items['things'])){

    $items['things']['title'] = t("New title");
    $items['things']['callback'] = 'new_callback';
    $items['things']['file path'] = drupal_get_path("module", "bonus")."/includes/";
    $items['things']['file'] = 'bonus.pages.inc';



The problem is that the file path of the new file is including the original modules path and spitting this out:


The original implementation of the parent hook_menu():

 * Implements hook_menu().
function things_menu() {
  $items['things'] = array(
    'title' => 'Things title',
    'page callback' => 'things_callback',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
    'file' => 'includes/things.pages.inc',
  return $items;

What could I be doing wrong?

  • Silly me, always make sure "page callback" is called that and not "callback" like i had done :)
    – Chiko
    Sep 7, 2015 at 18:02
  • "page callback" happened to be a side issue. Not the answer to the actual issue in this question. Voting to re-open.
    – No Sssweat
    Dec 2, 2018 at 3:05

1 Answer 1


I think this happens because your alter hook does not update the value for $items['bonus']['module'], which was automatically set to 'things' when menu_router_build processed things_menu(). Try this:

$items['bonus']['module'] = 'bonus';
$items['bonus']['file path'] = '/includes/';
$items['bonus']['file'] = 'bonus.pages.inc';

or simply this, more like the things module does:

$items['bonus']['module'] = 'bonus';
$items['bonus']['file'] = 'includes/bonus.pages.inc';

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.