hook_menu title callback on wildcard I have two pages, the first page 'test' has links to test/%.
On test/% I want to have different titles but some how this wildcard
and the title callback aren't working properly.

/**
 * Implements hook_menu().
 */
function cjgimport_menu() {
  $items['test'] = array(
    'title' =&gt; t('Test title'),
    'title callback' =&gt; 'function_title_callback',
    'title arguments' =&gt; array(0),
    'type' =&gt; MENU_NORMAL_ITEM,
    'access arguments' =&gt; array('access content'),
    'page callback' =&gt; 'function_content_callback',
  );

  $items['test/%'] = array(
    'title' =&gt; t('Test title'),
    'title callback' =&gt; 'function_title_callback',
    'title arguments' =&gt; array(1),
    'type' =&gt; MENU_NORMAL_ITEM,
    'access arguments' =&gt; array('access content'),
    'page callback' =&gt; 'function_content_callback',
  );

  return $items;
);

/**
 * Custom callback function for title
 */
function function_title_callback($arg) {
  if($arg == 0) {
    $title = ucfirst(arg(0));
  } else {
    $title = ucfirst(arg(1));
  }
  return $title;
}


Can anyone tell me why the title doesn't work on the test/% pages?
You need to provide the wildcard as title arguments:

$items['test/%'] = array(
  'title' =&gt; t('Test title'),
  'title callback' =&gt; 'function_title_callback',
  'title arguments' =&gt; array(1),
  'type' =&gt; MENU_NORMAL_ITEM,
  'access arguments' =&gt; array('access content'),
  'page callback' =&gt; 'function_content_callback',
);


And obviously make sure that your function is actually called function_title_callback() (which you've listed in hook_menu()), and not cjgimport_title_callback(), which you have listed in the question.

You should also be using the $arg variable, not the arg() function in your callback...but I guess that might be the result of debugging.