How to Display Child Taxonomy on Parent Taxonomy’s Archive Page
-
by cobra_admin
- 32
Do you want to learn how to display a child taxonomy on a parent taxonomy archive page?
You may need to do this when customizing your taxonomy archive page to make it more useful to your visitors.
In this article, we will show you how you can easily show your child taxonomies on your parent taxonomy archive page.

Why Display a Child Taxonomy on the Parent Taxonomy Archive Page?
By displaying all of your child taxonomies on the parent taxonomy archive page, you can make it less generic and more useful to your visitors.
For example, if you run a WordPress blog about books and have a taxonomy called ‘Subjects’, then you can add child taxonomies like ‘Fiction’, ‘Non-Fiction’, and more, so your readers can easily sort through your books.
When you have a lot of content, this not only makes it easier to stay organized but helps your visitors find related content faster.
For more details on using taxonomies, see our guide on how to create custom taxonomies in WordPress.
That being said, let’s show you how to display child taxonomies on parent taxonomy archive pages.
Displaying Child Taxonomies on Parent Taxonomy Archive Page
This tutorial requires some basic understanding of how to add code to WordPress. For more details, see our beginner’s guide to pasting snippets from the web into WordPress.
Then, you will need to find your WordPress theme’s taxonomy template file. It will usually be named something like taxonomy-{taxonomyname}.php
.
If you’ve created a custom taxonomy called ‘books’, then the name would be taxonomy-books.php
. If you don’t have this file, then you will need to create it first.
To learn more, see our WordPress template hierarchy cheat sheet to help find the taxonomy theme template file that you need to edit.
Once you have found the right taxonomy template file, you can simply add the following code to where you want to display the list:
12345678910111213141516171819202122 | <?php $term = get_term_by( 'slug' , get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if ( $term ->parent == 0) { $args = array ( 'taxonomy' => 'subject' , 'depth' => 1, 'show_count' => 0, 'title_li' => '' , 'child_of' => $term ->term_id ); wp_list_categories( $args ); } else { $args = array ( 'taxonomy' => 'subject' , 'depth' => 1, 'show_count' => 0, 'title_li' => '' , 'child_of' => $term ->parent ); wp_list_categories( $args ); } ?> |
Hosted with ❤️ by WPCode
1-click Use in WordPress
You need to replace the taxonomy subject
with the name of your taxonomy.
This code will identify the current parent taxonomy based on the post ‘slug’, then it will display any of the child taxonomies that are related to that term.
Here is how the child taxonomy list will look to your visitors.

Notice how it simply lists all of the child taxonomies of the single parent taxonomy. In this case, it shows the different book subjects present in our parent taxonomy.
For more details on customizing your taxonomy page, see our guide on how to show the current taxonomy title, URL, and more in WordPress.
We hope this article helped you learn how to display a child taxonomy on the parent taxonomy archive page. You may also want to see our guide on the difference between a domain name and web hosting and our expert picks of the best GoDaddy alternatives.
Do you want to learn how to display a child taxonomy on a parent taxonomy archive page? You may need to do this when customizing your taxonomy archive page to make it more useful to your visitors. In this article, we will show you how you can easily show your…
Do you want to learn how to display a child taxonomy on a parent taxonomy archive page? You may need to do this when customizing your taxonomy archive page to make it more useful to your visitors. In this article, we will show you how you can easily show your…