How to display Custom taxonomy on custom post listing page [duplicate]

I want to show the custom taxonomy name on the listing of custom post type on my front end


You can get terms by posts with this functions.

$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "ids"));

And echo or use different with foreach(). This tip get terms with ID. You can get another properties. wp_get_post_terms() in codex.

  1. Get term by id and taxonomy => $term = get_term($term_id, ‘my_taxonomy’);
  2. Get term name by id => $term->name;
  3. Get term link by id = >get_term_link($term_id, ‘my_taxonomy’); // codex for it

Source : Link , Question Author : Pratik bhatt , Answer Author : Fatih SARI

Leave a Comment