August 15, 2018
$terms = get_the_terms( $post->ID, 'taxonomy' ); foreach($terms as $term) { } $child_term = get_term( $term->term_id, 'taxonomy' ); $parent_term = get_term( $child_term->parent, 'taxonomy' ); echo $term->name; echo $parent_term->name;
this is amazing, thanks. Tried about 20 other snippets and this one finally did the trick on parent term!
Glad it worked out for you!