Hello I have create a custom taxonomy for a custom post. I want to get the taxonomy term that is used in the current post. How to get it.

  • What is the taxonomy? Can we see your code? What you want to use is $term_obj_list = get_the_terms( $post->ID, 'custom-taxonomy-here' ); Dec 23 '20 at 2:04

You can use below code to get the taxonomy by post ID:

$yourterms = get_the_terms( $post->ID , array( 'taxonomy_name') );
foreach ( $yourterms as $term ) {
 echo $term->name;
$tags = wp_get_post_tags($post->ID);
$html = '<div class="post_tags">';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
$html .= "{$tag->name}</a> ";  //this will get the  taxmont term.
$html .= '</div>';
echo $html;

This will Help You

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.