Get Post Terms of Current Post (selected taxonomy term) – How to get only the taxonomy value and not “Array ( [0] => taxonomy term )” in the frontend?

Question

I use the get_post_term code from https://codex.wordpress.org/Function_Reference/wp_get_post_terms.
I can retrieve the selected taxonomy term from the current post but the displayed value looks like this: Array ( [0] => Taxonomy Term).
I only want the taxonomy term in the frontend.

//Returns Array of Term Names for "my_taxonomy"
$term_list = wp_get_post_terms($post->ID, 'my_taxonomy', array("fields" => "names"));
print_r($term_list);

Does someone know how to only display the selected taxonomy term?

0
, , Moe 4 years 2017-11-05T05:15:27-05:00 0 Answers 84 views 0

Leave an answer

Browse
Browse