Skip to content

Instantly share code, notes, and snippets.

@mikedamage
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikedamage/f19fdb5d67215791ad94 to your computer and use it in GitHub Desktop.
Save mikedamage/f19fdb5d67215791ad94 to your computer and use it in GitHub Desktop.
WP taxonomy terms
<?php
$terms = get_the_terms($post->ID, 'industry');
// Terms is now an array filled with taxonomy term objects.
var_dump($terms);
// Loop through terms using foreach
foreach ($terms as $term):
$term_link = get_term_link($term->term_id, 'industry');
?>
<a href="<?php echo $term_link; ?>"><?php echo $term->name; ?></a>
<?php endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment