Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

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

#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 ;)