How to Show the Current Taxonomy Title, URL, & More in WordPress

Do you want to show the current taxonomy title, title, URL, and more on your taxonomy archive pages in WordPress?

You may need this when creating custom templates for your taxonomy archives. This includes categories, tags, and any other custom taxonomies you may be using.

In this article, we’ll show you how to easily display the current taxonomy title, URL, and more in WordPress.

Display current taxonomy title, URL, and more in WordPress theme

Creating Taxonomy Archive Templates in WordPress Themes

If you are learning WordPress theme development or making your own custom WordPress theme, then you may want to create custom templates for taxonomy pages like categories, tags, or any custom taxonomies you may have on your site.

The good news is that WordPress comes with a powerful templating engine. This allows you to easily create custom templates in your theme for different parts of your WordPress website.

For instance, you can simply create a category.php template in your theme and WordPress will then use it to display your category archive pages.

Example of a taxonomy template used in a WordPress theme

Similarly, you can create a template for any custom taxonomy by naming it in the taxonomy-{taxonomy}-{term}.php format. For more details, see our complete WordPress template hierarchy cheat sheet for beginners.

Once you have created a taxonomy template file, you may copy and paste your theme’s archive.php template code as a starting point.

However, it would be very generic and you may want to make it more specific for taxonomy pages.

For instance, you may want to display the taxonomy title in different places, perhaps add a link to the taxonomy RSS feed, display the taxonomy description, show the number of articles, and more.

That being said, let’s take a look at how to fetch the taxonomy-related data in WordPress and display it your WordPress theme.

Showing Taxonomy Title, URL, and More in WordPress

To display all your taxonomy-related data, you will need to dynamically find out which taxonomy page is displayed and then get all the required data for that particular taxonomy term.

First, you need to copy and paste and the following code into your taxonomy template.


This gets the information of the current taxonomy based on the page you are on.

For example, if you were on a category page called “business”, then it will get the information for that taxonomy term.

After that line of code, you can use it to display the title of the taxonomy and other info like this:

echo $term->name; // will show the name
echo $term->taxonomy; // will show the taxonomy
echo $term->slug; // will show taxonomy slug

You can use it for the all of the following values:

  • term_id
  • name
  • slug
  • term_group
  • term_taxonomy_id
  • taxonomy
  • description
  • parent
  • count
  • filter
  • meta

Let’s take a look at a real example. In our test child theme, we wanted to display the term title, taxonomy name, number of articles, and the term description.

We used the following code to display this data:



name; ?>taxonomy; ?> (count; ?> articles)

description; ?>

You can see we added some CSS classes so we could add custom CSS to style the text, too.

Here is how it looked on our test site:

Taxonomy template

We hope this article helped you learn how to show the current taxonomy title, URL, and more in WordPress themes. You may also want to see our cheat sheet for WordPress theme developers or check out these WordPress page builder plugins for no-code solutions.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.