Skip to content

Instantly share code, notes, and snippets.

@jcamp
Forked from barbwiredmedia/object_terms.php
Created July 7, 2018 10:45
Show Gist options
  • Save jcamp/bf1abcc536bf29fb3bd7edf0707c4b62 to your computer and use it in GitHub Desktop.
Save jcamp/bf1abcc536bf29fb3bd7edf0707c4b62 to your computer and use it in GitHub Desktop.
In the loop: list the terms from the current post http://codex.wordpress.org/Function_Reference/wp_get_object_terms#Examples
<?php $item_terms = wp_get_object_terms($post->ID, 'your_taxonomy_name');
if(!empty($item_terms)){
if(!is_wp_error( $item_terms )){
foreach($item_terms as $term){
echo '<h2>'.$term->name.'</h2>';
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment