Codex

Function Reference/get term link

Contents

Description

Returns permalink for a taxonomy term archive.

Usage

<?php get_term_link$term$taxonomy ); ?> 

Parameters

$term
(object/int/string) (required) The term object / term ID / term slug whose link will be retrieved.
Default: None
$taxonomy
(string) (required) The taxonomy slug. NOT required if you pass the term object in the first parameter
Default: None

Return Values

URL (string) 
URL to taxonomy term archive.

Examples

$terms = get_terms('species');
echo '<ul>';
foreach ($terms as $term) {
    echo '<li><a href="'.get_term_link($term->slug, 'species').'">'.$term->name.'</a></li>';
}
echo '</ul>';

Notes

  • Uses: apply_filters() Calls 'term_link' filter on the finished link.
  • Uses global: (unknown) $wp_rewrite
  • Since the term can be an object, int, or string make sure that any numbers you pass in are explicitly converted to an integer. (int)$myID

Change Log

Source File

get_term_link() is located in wp-includes/taxonomy.php.

Related

Categories: the_category(), the_category_rss(), single_cat_title(), category_description(), wp_dropdown_categories(), wp_list_categories(), get_the_category(), get_the_category_by_ID(), get_category_by_slug(), get_the_category_list(), get_category_parents(), get_category_link(), is_category(), in_category()

Terms: is_term(), term_exists(), get_objects_in_term(), get_term(), get_term_by(), get_term_children(), get_term_link(), get_terms(), get_the_terms(), get_the_term_list(), has_term(), sanitize term(), wp_get_object_terms(), wp_set_object_terms(), wp_get_post_terms(), wp_set_post_terms()

See also index of Function Reference and index of Template Tags.