4.6.x taxonomy.module taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page')
4.7.x taxonomy.module taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page')
5.x taxonomy.module taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page')
6.x taxonomy.pages.inc taxonomy_term_page($str_tids = '', $depth = 0, $op = 'page')
7.x taxonomy.pages.inc taxonomy_term_page($term)

Menu callback; displays all nodes associated with a term.


$term: The taxonomy term.

Return value

The page content.

1 call to taxonomy_term_page()
TaxonomyHooksTestCase::testTaxonomyTermHooks in modules/taxonomy/taxonomy.test
Test that hooks are run correctly on creating, editing, viewing, and deleting a term.
2 string references to 'taxonomy_term_page'
drupal-6.filled.database.php in modules/simpletest/tests/upgrade/drupal-6.filled.database.php
Filled installation of Drupal 6.17, for test purposes.
taxonomy_menu in modules/taxonomy/taxonomy.module
Implements hook_menu().


modules/taxonomy/taxonomy.pages.inc, line 16
Page callbacks for the taxonomy module.


function taxonomy_term_page($term) {
  // If there is a menu link to this term, the link becomes the last part of
  // the active trail, and the link name becomes the page title. Thus, we must
  // explicitly set the page title to be the term title.

  // Build breadcrumb based on the hierarchy of the term.
  $current = (object) array(
    'tid' => $term->tid,
  // @todo This overrides any other possible breadcrumb and is a pure hard-coded
  //   presumption. Make this behavior configurable per vocabulary or term.
  $breadcrumb = array();
  while ($parents = taxonomy_get_parents($current->tid)) {
    $current = array_shift($parents);
    $breadcrumb[] = l($current->name, 'taxonomy/term/' . $current->tid);
  $breadcrumb[] = l(t('Home'), NULL);
  $breadcrumb = array_reverse($breadcrumb);
  drupal_add_feed('taxonomy/term/' . $term->tid . '/feed', 'RSS - ' . $term->name);

  // Set the term path as the canonical URL to prevent duplicate content.
  $uri = entity_uri('taxonomy_term', $term);
  drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
  // Set the non-aliased path as a default shortlink.
  drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);

  // Normally we would call taxonomy_term_show() here, but for backwards
  // compatibility in Drupal 7 we do not want to do that (it produces different
  // data structures and HTML markup than what Drupal 7 released with). Calling
  // taxonomy_term_view() directly provides essentially the same thing, but
  // allows us to wrap the rendered term in our desired array structure.
  $build['term_heading'] = array(
    '#prefix' => '<div class="term-listing-heading">',
    '#suffix' => '</div>',
    'term' => taxonomy_term_view($term, 'full'),

  if ($nids = taxonomy_select_nodes($term->tid, TRUE, variable_get('default_nodes_main', 10))) {
    $nodes = node_load_multiple($nids);
    $build += node_view_multiple($nodes);
    $build['pager'] = array(
      '#theme' => 'pager',
      '#weight' => 5,
  else {
    $build['no_content'] = array(
      '#prefix' => '<p>',
      '#markup' => t('There is currently no content classified with this term.'),
      '#suffix' => '</p>',
  return $build;


qqboy’s picture

why this function got called, but produce extra data to taxonomy/term/* page. wonder how to skip it. thanks.