get a specific taxonomy term name

I need to print a specific term with its id. I get that for categories with this code:

<a href="<?php echo get_category_link(1); ?>" title="<?php echo get_cat_name(1);?>"><?php echo get_cat_name(1);?></a>

… where 1 is the id I have to print. Is there something like the following?

Read More
<?php echo get_term_link(1); ?>

or

<?php echo get_term_name(1); ?>

Related posts

Leave a Reply

2 comments

  1. Use get_term() to get the name, slug, or description:

    $term = get_term( 1, 'taxonomy_slug' );
    // Name
    echo $term->name;
    
    // Link
    echo get_term_link(1, 'taxonomy_slug'); 
    // OR
    echo get_term_link( $term ); 
    
  2. Since WP 2.3.0, there is an API to get term’s fields : get_term_field().

    So, I would rather use <?php get_term_field( 'key', $term ); ?> which is pretty handy :

    • key : could be multiple : link, name, etc.
    • $term : can either be the term_id or the WP_Term object.