Skip to content

Instantly share code, notes, and snippets.

Last active Dec 18, 2021
What would you like to do?
Output a Custom Taxonomy Loop of Terms
// Taxonomy Loop
* Get the Custom Taxonomy
* For a list of other parameters to pass in see link below
* @link
* For a list of get_term return values see link below
* @link
$terms = get_terms( array(
'taxonomy' => 'custom_taxonomy_name', // Swap in your custom taxonomy name
'hide_empty' => true,
echo '<ul>';
// Loop through all terms with a foreach loop
foreach( $terms as $term ) {
// Use get_term_link to get terms permalink
// USe $term->name to return term name
echo '<li><a href="'. get_term_link( $term ) .'">'. $term->name .'</a></li>';
echo '</ul>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment