Display post terms

431

Last updated

Added

Informations

This code loop on the terms of a taxonomy for a post. In this snippet, we get the category title with echo $term->name and the category link with echo get_term_link($term).

Code

<?php foreach (get_the_terms(get_the_ID(), ‘taxonomy_name’) as $term) : ?>
 
  <?php echo $term->name; ?>
  <?php echo get_term_link($term); ?>
 
<?php endforeach; ?>

Contribute to this page

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *


name; ?>