Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Create Custom Taxonomies in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Create Custom Taxonomies in WordPress

Many people think of WordPress as a blogging tool, mainly because it has posts, categories, tags, etc. What most people don’t know is that all posts, categories, tags, can be replaced by custom post types and custom taxonomies. In this article we will show you how to create custom taxonomies in WordPress as well as how to display custom taxonomies in your WordPress theme.

What is a Taxonomy?

Taxonomy in WordPress is one of those things that everyone use, but they do not know that they are using it. Derived from the biological classification method Linnaean taxonomy, WordPress taxonomies are used as a way to group posts and custom post types together. WordPress has two very popular taxonomies that people use on a regular basis: Categories and Tags (Read: Categories vs. Tags: Best Practices). You can use custom taxonomies to create custom groups and bring them under one umbrella. For example, you have a custom post type called Books. Even though you can use categories, you may not want to mix the two because they are used differently. You can register a new custom taxonomy called Topics. You can add topic terms like: Adventure, Romance, Non-Fiction, etc. This would allow you and your users to sort your books by each topic. Taxonomies can also be hierarchical meaning that you can have main topics like: Fiction, Non-Fiction, and Children. Then have subtopics under each category for example fiction would have thrillers as a sub-topic.

Now that you know what is a custom taxonomy, let’s learn how to create custom taxonomies in WordPress. We will use two methods to create custom taxonomies. Method 1 would utilize a plugin for those who choose not to deal with code. Method 2 on the other hand would be the code method for those who prefer to do everything without a plugin.

Video Tutorial

If you don’t like the video or need more instructions, then continue reading.

Creating Custom Taxonomies – The Easier Way

Let’s start creating a custom taxonomy. First, you need to install and activate Simple Taxonomy WordPress plugin. Go to Settings » Custom Taxonomies to create a new taxonomy:

Creating a custom taxonomy in WordPress

The first part of creating a custom taxonomy is giving it a name, which needs to be all lowercase and no weird characters. The second option is whether or not this taxonomy will be hierarchical. If you want to create a taxonomy like categories where you can add a parent and child term then choose True, other wise choose false if you want terms to be added like tags.

Third option is to associate this taxonomy with a post type and last option is whether or not you want to add terms automatically, choose none.

But we are not done yet. Lets assume that you are creating a taxonomy and calling it Topics. Now you need to tell WordPress how it should translate user interface for the topics.

Translating taxonomy for UI

After providing translations for the UI, press the Add Taxonomy button. Once a custom taxonomy is created, it will appear under Posts and will have a similar interface like Categories or Tags. Also the custom taxonomy field will also appear in post edit area.

Custom taxonomy in Post Edit area

Manually Creating Custom Taxonomies

Add the following code in your theme’s functions.php file or in a site-specific plugin (recommended) to create a hierarchical custom taxonomy like categories:

//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_topics_hierarchical_taxonomy', 0 );

//create a custom taxonomy name it topics for your posts

function create_topics_hierarchical_taxonomy() {

// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI

  $labels = array(
    'name' => _x( 'Topics', 'taxonomy general name' ),
    'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Topics' ),
    'all_items' => __( 'All Topics' ),
    'parent_item' => __( 'Parent Topic' ),
    'parent_item_colon' => __( 'Parent Topic:' ),
    'edit_item' => __( 'Edit Topic' ), 
    'update_item' => __( 'Update Topic' ),
    'add_new_item' => __( 'Add New Topic' ),
    'new_item_name' => __( 'New Topic Name' ),
    'menu_name' => __( 'Topics' ),

// Now register the taxonomy

  register_taxonomy('topics',array('post'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'topic' ),


To create a non-hierarchical custom taxonomy like Tags, add this code in your theme’s functions.php or in a site-specific plugin:

//hook into the init action and call create_topics_nonhierarchical_taxonomy when it fires

add_action( 'init', 'create_topics_nonhierarchical_taxonomy', 0 );

function create_topics_nonhierarchical_taxonomy() {

// Labels part for the GUI

  $labels = array(
    'name' => _x( 'Topics', 'taxonomy general name' ),
    'singular_name' => _x( 'Topic', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Topics' ),
    'popular_items' => __( 'Popular Topics' ),
    'all_items' => __( 'All Topics' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Edit Topic' ), 
    'update_item' => __( 'Update Topic' ),
    'add_new_item' => __( 'Add New Topic' ),
    'new_item_name' => __( 'New Topic Name' ),
    'separate_items_with_commas' => __( 'Separate topics with commas' ),
    'add_or_remove_items' => __( 'Add or remove topics' ),
    'choose_from_most_used' => __( 'Choose from the most used topics' ),
    'menu_name' => __( 'Topics' ),

// Now register the non-hierarchical taxonomy like tag

    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'show_admin_column' => true,
    'update_count_callback' => '_update_post_term_count',
    'query_var' => true,
    'rewrite' => array( 'slug' => 'topic' ),

Notice the difference between two codes. Value for hierarchical argument is true for category-like taxonomy and false for tags-like taxonomies. Also in the labels array for non-hierarchical tags-like taxonomy, we have added null for parent_item and parent_item_colon arguments which means that nothing will be shown in the UI to create parent item.

Displaying Custom Taxonomies

Here is how you can display the terms you added to a custom taxonomy on your single post page. Add this single line of code in your single.php file within the loop:

<?php the_terms( $post->ID, 'topics', 'Topics: ', ', ', ' ' ); ?>

You can add it in other files as well such as archive.php, index.php, and anywhere else you want to display the taxonomy.

By default your custom taxonomies use the archive.php template to display posts. However, you can create a custom archive display for them by creating taxonomy-{taxonomy-slug}.php.

Custom taxonomies can be used in many ways. Combine them with custom post types and custom meta boxes, and you can create highly customized content management system (CMS) built to meet your needs. Let us know how you are using custom taxonomies on your websites?

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Olivier says:


    I am new to WordPress and coding in general. This tutorial is very well explained, thank you.

    However I don’t understand how to display the terms of my taxonomy on my pages.
    Where do I have to go to “Add this single line of code in your single.php file within the loop” ?

    Thank you for your help

  2. Azamat says:

    Thank you so much for this great tutorial!
    I created custom taxanomy on my website dedicated to books and now I’m able to filter books by authors!

  3. James Angel says:

    The trouble with some plugins is that they may not be compatible with all themes. I have found that it pays to have a qualified developer do his/her part and test and troubleshoot any Web site alteration after adding a plugin or updating WordPress to a newer version to ensure everything works as it should.

  4. paul says:

    Man you are a legend,
    i struggled 3 days to get this, which i found in many websites, but not as clear as this.

  5. Ayla says:

    I’ve created a custom post type and a taxonomy to go with it, but when I create a custom post and add tags to it they don’t show up like normal tags do on normal posts. How do I get them to display at the bottom of the post like normal so people can click on them and find more like it?

    Thank you!

    • WPBeginner Support says:

      You will need to create a new template to display your custom post type and edit that template to show your custom taxonomy.

  6. Giulia says:

    Hi everybody! First of all thank you for this article!
    I’ve found that “Simple Taxonomies” plugin is kind of out of date, since it hasn’t been updated since 2 years…. do you have any other plugin to suggest to create custom taxonomies?
    thanks :-)

    • Mario says:

      I’m not the author of this post, but I use “Custom Post Type UI” to create custom taxonomies. With 300k installs, I’m pretty sure this plugin is as close as you can get to industry standard.

      Hope this helps!

  7. Ryan Hall says:

    Amazing. thank you!

  8. Ryan says:

    How do you disassociate the posts with the “regular” categories?

  9. Sunny says:


    The description is not prominent by default; however, some themes may show it. But still show on front.

    How to hide taxonomy description from front ?
    I want to add description on taxonomy but i don’t want they show on front .

    Please tell me about what i can do.

    Thank You

  10. ajax says:

    How do one automate the population of the taxonomy value with the value in a custom field.

  11. Charles Hall says:

    The article is OK, but the video is very poor. The sound quality is bad, she talks way too fast, obvious things are elaborated on but the explanation of what you’re doing and why is missing, as is the other content in the lower portion of the article.

  12. Jennifer says:

    I am working on a WordPress website. I created categories using a plugin called “Categories Images”. One of the categories is named “Videos” so there is one folder/category that is supposed to show videos but images. The problem is, because the plugin is designed to upload images only, the YouTube videos do not show up. How can I edit the PHP files (create a custom taxonomy, edit single.php, edit taxonomy-{taxonomy-slug}.php, etc.) so that the post can show and play YouTube videos??

    • Jamie Wallace says:

      If you want more control over how things are pulled from the backend to the frontend look into using the Advanced Custom Fields plugin. This is a plugin for developers (so some code is involved) but its very powerful for things like what you ask

  13. Muhammad says:

    Hi I have followed the manual way of creating custom taxonomy and i just used Ads/Ad instead of Topics/Topic . But i don’t see any custom taxonomy in post editor though i checked the custom taxonomy form Screen Options.

    though the custom taxonomy(Ads) is showing in admin submenu under Posts.

    • Muhammad says:

      Here is my code snipped in functions.php file

      _x( ‘Ads’, ‘taxonomy general name’ ),
      ‘singular_name’ => _x( ‘Ad’, ‘taxonomy singular name’ ),
      ‘search_items’ => __( ‘Search Ads’ ),
      ‘all_items’ => __( ‘All Ads’ ),
      ‘parent_item’ => __( ‘Parent Ad’ ),
      ‘parent_item_colon’ => __( ‘Parent Ad:’ ),
      ‘edit_item’ => __( ‘Edit Ad’ ),
      ‘update_item’ => __( ‘Update Ad’ ),
      ‘add_new_item’ => __( ‘Add New Ad’ ),
      ‘new_item_name’ => __( ‘New Ad Name’ ),
      ‘menu_name’ => __( ‘Ads’ ),

      // Now register the taxonomy

      register_taxonomy(‘ads’,array(‘post’), array(
      ‘hierarchical’ => true,
      ‘labels’ => $labels,
      ‘show_ui’ => true,
      ‘show_admin_column’ => true,
      ‘query_var’ => true,
      ‘rewrite’ => array( ‘slug’ => ‘ad’ ),



  14. Robert Herold says:

    How to show the number of posts on taxonomy-{taxonomy-slug}.php? :)

  15. Robert Herold says:

    How can I display my custom taxonomies list like the category list

  16. Abdul Rauf Bhatti says:


    I have learned many things in this tutorial next time will you please elaborate functions parameter which you have used some time i got in trouble or confused with parameters.

    Thanks a lot Nice tutorial 5 rating

    • WPBeginner Support says:

      Thanks for the feedback, we will try to improve our code explanation in the future.

  17. lee says:

    Is there a way to get multiple custom taxonomy to use the same slug or same url? Please show us how if you or anyone knows.

  18. pdepmcp says:

    It may sound obvious, but…remember to refresh the permalink cache or you can waste some hours trying to figure out why archive pages don’t work…

  19. winson says:


    How can I get a different Posts Link? I mean I want to get 2 different links after I published a New Post.


    Category Name – > Facebook (theme template A)

    Topic Name – > Twitter (theme template B)

    Then I submit a post to these 2 Categories. I want get 1 link for “Facebook” and 1 Link for “Twitter”.

    Best Regards

  20. foolish coder says:

    how to create single pages / templates for taxonomies?

    I mean like single.php not like category.php

  21. WPBeginner Staff says:

    Yes, you can do that.

  22. fatima says:

    what if we want to create more than 2 taxonomies, categories style (hierarchy true)

  23. Aalaap Ghag says:

    I’m building a site which has multiple item thumbnails, each of which leads to a page with multiple images for that item (i.e. product). Are taxonomies the way to go or should I be looking at something else?

  24. leona says:

    Hi This is a great tutorial. But what if I want to display a custom taxonomies as posts in my menu? for instance I have a custom post type called ‘poems’ and custom taxomies classic, modern, new wave. each poem post is assigned one of these taxonomies. In the menu I want to see a menu entitled poems with 3 subheadings (classic, modrn, new wave). Each will display only the poems tagged with one taxonomy. Is this possible?

  25. angel1 says:

    This is great! How do I create “related posts” for the custom taxonomy?

    I’m assuming I need to put a conditional php code to display related posts for the new custom taxonomy to appear only when it’s a new taxonomy post and to hide when it is a basic category/tag post since they are both sharing the same content.php file.

    Any suggestions would be greatly appreciated.

  26. SteveMTNO says:

    I used the code above to create the custom taxonomy – everything worked great. The field was added to all of my posts, and I populated it accordingly.

    I’m using the “Taxonomy Dropdown Widget” plugin – that works too.. sort of.

    The dropdown is populated correctly, but when you click on one of the items to display those posts, I get a 404. However the plugin works for displaying tags.

    Any ideas? I’ll be happy to post my code, just wasn’t sure if I paste it in here or somewhere and link to it here instead.

    Let me know.. thanks!


  27. David says:

    Bad tutorial. You just expect people to copy/paste the code and don’t explain how it works.

    • WPBeginner Support says:

      No, we don’t want people to just copy paste the code, we want them to study it and modify if they want.

  28. Cletus says:

    Hi, can you recommend a different taxonomy plugin that works?
    Even a premium version, the one you’ve posted hasn’t been updated in months and the author seems to have done one.

    • WPBeginner Support says:

      The plugin works great, and the author has 19 other plugins. It also has great reviews and we have personally tested and used it. However, if you would still like to try some other plugin, then you can look at GenerateWP which will allow you to generate the code for your custom taxonomy. You can then paste this code in your theme’s functions.php file or a site-specific plugin.

  29. Dineshkumar says:

    I am beginner using classifieds wordpress theme my taxonomy list is not working correctly
    when i select country it shows correct bt when i select state it shows state list with city list when i select city i doesnot show below the parent how can i solve it without using plugin please help me

  30. Joe says:

    This is probably a newbie question, but I can’t find the answer anywhere. I want to display the hierarchical path of each page at the top of the page. This page for example has “WPBEGINNER» BLOG» TUTORIALS» HOW TO CREATE CUSTOM TAXONOMI…” at the top and each item is a link. I lack the web vocabulary to know what this is called. If anyone can tell me what terms to search for to figure out how to do this that would be excellent.

    • WPBeginner Support says:

      Joe these are called breadcrumbs. You can add breadcrumbs to your site using Yoast’s WordPress SEO Plugin. You can also search for breadcrumbs on WordPress plugin directory to find other plugins.

  31. Mark says:

    I was getting 404 after manually setting up a custom taxonomy with your instructions and code. For anybody else who does, below is the solution I found on Codex.

    “If your site uses custom permalinks, you will need to flush your permalink structure after making changes to your taxonomies, or else you may see a “Page Not Found” error. Your permalink structure is automatically flushed when you visit Settings > Permalinks in your WordPress dashboard. “

    • SteveMTNO says:

      I was getting the same 404 issue after making the taxonomy change. Flushing the permalinks worked perfectly.. thanks!

  32. Pepper says:

    thank you so much for your awesome tutorials!

  33. Jordan says:

    Hello, thank you for the great article.

    Is there anyway to create a page for a custom taxonomy?

    Right now my custom taxonomy is called “issue” and I want to display all issue 1 posts on the home page. The problem is, the link looks like this which is fine. Except that there is no way to make wordpress register this as the home page


    • WPBeginner Support says:

      You can replace your default index template with home.php inside home.php add this line just before the loop
      $query = new WP_Query( array( ‘issues’ => ‘issue 1’ ) );

  34. Keisa says:

    How can I display each taxonomy on separate pages?

    For example//

    PSDS (page)
    —Vampire Diaries
    ——–Elena Gilberts

    —Teen Wolf
    ——–Derek Hale
    ——–Scott McCall
    ——–Stiles Stilinski
    ——–Lydia Martin

    How could I display each character on their own page using taxonomies?

    I used “psd_categories” for the taxonomy, then I added “Teen Wolf” as a category.
    I found a way to display links to the show’s page, but I have no idea on how to display all posts under each characters name…
    I’m extremely new to this so please bare with me lol.

    Can I send an email perhaps? >.<

    • WPBeginner Support says:

      If you are using permalinks then you should automatically have separate pages for each term in a taxonomy.

      For example if you create a taxonomy called characters, and mark some posts with term Stephen, then those posts will appear on

  35. JNorell says:

    The archive-{taxonomy-slug}.php template did not work for me in WordPress 3.6 .. it needs to be taxonomy-{taxonomy-slug}.php instead (see

    Thanks for the tutorial, it was helpful!

  36. Kiki says:

    Is there a way to make the categories not hyperlinks? I just want them listed. I don’t want them to link anywhere.

  37. Azis says:

    thanks for the easy-to-understand tutorial :D

    and could you help me to insert those custom taxonomies into the post class? like, for example… when we put a category named ‘tutorial’ into the post, the category would normally get inserted in the post class as ‘category-tutorial’, right? but it seems the example from this article doesn’t do that.

    Once again, thanks for this great article.

    P.S: I choose the manual way to create the custom taxonomies, since I prefer not to use additional plugins for my site if possible.

  38. Robby Barnes says:

    Hello and thanks for this information.

    I am using the Responsive Child Theme on WP 3.5.1 on DreamHost.

    I am building a WordPress site for a small print publication. I am trying to get my WordPress pages (not posts) to display the names of authors of articles that are on the pages. I installed the Simple Taxonomy plugin and created a custom taxonomy. I set it to work on pages and media, but not on posts. Using the widget for Simple Taxonomies I was able to have the author names show up on the right sidebar.

    The custom taxonomy shows up on the Edit Page admin panel and seems to permit me to select authors to associate with a page… But, after updating the page the authors don’t appear on the HTML page.

    I followed your suggestion and pasted some code into what I believe is the Loop (not sure if pages have the loop) and it didn’t change anything.

    I would appreciate any suggestions for dealing with this. / Robby, Seattle, USA

    • Editorial Staff says:

      The pages do have loop, and yes you would have to paste the code to make sure the taxonomy appears on the HTML page. Email us the page.php file or where you added the code. Use our contact form.

  39. Mattia says:

    Hi, in the code example, I am missing how you link the “topic” custom taxonomy to the “books” custom post type… Should I replace “post” with “books”?

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.