Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress Show Taxonomy Term Title and Slug inside loop #wordpress
<?php
// Print term slug
$terms = get_the_terms( $post->ID , 'oil' );
if ( $terms != null ){
foreach( $terms as $term ) {
print $term->slug ;
unset($term);
} }
// Get term title
$terms = get_the_terms( $post->ID , 'oil' );
if ( $terms != null ){
foreach( $terms as $term ) {
print $term->name ;
unset($term);
} } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment