Created
March 24, 2017 18:55
-
-
Save gera3d/65996c659728f7d36c9f17d81dd4e6b0 to your computer and use it in GitHub Desktop.
Return a list of all 'product' taxonomy terms that are applied to.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$product_terms = wp_get_object_terms( $post->ID, 'product' ); | |
if ( ! empty( $product_terms ) ) { | |
if ( ! is_wp_error( $product_terms ) ) { | |
echo '<ul>'; | |
foreach( $product_terms as $term ) { | |
echo '<li><a href="' . get_term_link( $term->slug, 'product' ) . '">' . esc_html( $term->name ) . '</a></li>'; | |
} | |
echo '</ul>'; | |
} | |
} |
replace product with testimonial-types to get what I needed to query.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed to change $post->ID to $post_object->ID so I could get data from the object vs the post.