Get custom taxonomy term name on an archive page on WordPress

If you're viewing normal Post category via your archive.php template, you can use single_cat_title() to display the category name. But when dealing with custom taxonomies it's a bit different.

And it is as simple as:


$tax = $wp_query->get_queried_object();
echo '

' . $tax->name . '

'; //echo it out

That’s all.

Comments

Club-Mate, the beverage → club-mate.fi