Display taxonomy terms

441

Last updated

Added

Informations

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

Code

<?php
$terms = get_terms(array(
  ‘taxonomy’ => ‘taxonomy_name’,
  ‘hide_empty’ => true,
));

?>

 

<?php foreach ($terms 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 *


'taxonomy_name', 'hide_empty' => true, )); ?> name; ?>