Skip to content

Instantly share code, notes, and snippets.

@mikeoberdick
Created August 1, 2017 17:50
Show Gist options
  • Save mikeoberdick/f67d38f575a4b00bc9ddde39df7a861b to your computer and use it in GitHub Desktop.
Save mikeoberdick/f67d38f575a4b00bc9ddde39df7a861b to your computer and use it in GitHub Desktop.
Show All Custom Post Type Taxonomy Terms
<?php
$taxonomy = 'portfolio_categories';
$terms = get_terms($taxonomy); // Get all terms of a taxonomy
if ( $terms && !is_wp_error( $terms ) ) :
?>
<ul>
<?php foreach ( $terms as $term ) { ?>
<li><a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li>
<?php } ?>
</ul>
<?php endif;?>
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment