WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a loop of posts for a custom post type I built.

How can i call the link of the category/taxonomy for each post?


share|improve this question

Use get_term_link(); for example:

$terms = wp_get_post_terms( $post->ID, 'category');
echo '<ul>';
foreach ($terms as $term) {
    echo '<li><a href="'.get_term_link($term->slug, 'category').'">'.$term->name.'</a></li>';
echo '</ul>';
share|improve this answer
what if i have 2 categories assigned @Bainternet ?.. can i stop the foreach after one time ? – Sagive SEO Mar 16 '12 at 20:17
Yeah you can, ask that as a new question and I'll show you.\ – Bainternet Mar 16 '12 at 22:59
thanks man :) got lucky and found a good explenation - thanks anyhow and have a gr8 weekend – Sagive SEO Mar 17 '12 at 4:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.