Home › Forums › Back End › WordPress: show title of the term (custom taxonomy) inside the custom post type › Reply To: WordPress: show title of the term (custom taxonomy) inside the custom post type
October 22, 2013 at 3:00 am
#153671
Tomasz Lisiecki
Participant
Hello :)
There you go
$name = wp_get_post_terms(get_queried_object()->ID,'projects',array("fields" => "names"));
echo $name[0];
Note:
wp_get_post_terms
returns an array of all assigned categories to that post, hence $name[0]
. It is also future proof, so if you want to display all categories of the post at some point, you can just loop through $name
variable.
Hope it helps ;)