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?

<?php echo get_term_link(1); ?>


<?php echo get_term_name(1); ?>

2 Answers 2


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 ); 
  • You're welcome. Please mark this question as being answered, so it goes off the list of unanswered questions. :) Oct 31, 2012 at 17:46
  • I'm sorry! I am beginner and especially my English :P:P i've marked it rigth?
    – federica
    Oct 31, 2012 at 17:54
  • Beside my answer there should be a checkmark ✓ <- Click it! :D Oct 31, 2012 at 17:57
  • ok! i did it :)
    – federica
    Oct 31, 2012 at 18:03
  • 1
    Glad to hear there's a built in way to do this now. I think you're being a bit dramatic with a 2-line solution being long/inconvenient, though @MaximeCulea Oct 8, 2020 at 15:24

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.
  • 1
    I think this should be the selected answer. Being that the orginial question assumes you have the TERM ID, using this method only requires one line. Simple and to the point!
    – Brev Tiw
    Oct 13, 2018 at 23:14

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.