A Basic Explanation of WordPress Taxonomies

Over the last week or so I’ve started playing intensely with custom taxonomies in WordPress,  and the geek in me is in love with the possibilities. Now, before you go running off thinking this is only hardcore “geek stuff” let me explain what taxonomies are, why they are important and provide a basic example of how to use them. I’ll expand on all of this is a future series of posts but I wanted to start with the basics since it will give me something to refer back to and will sent the groundwork for understanding taxonomies.

For ease of explanation, let’s pretend we have a website that is about entertainment. (Disclaimer: I’m using the example of entertainment because I want to point you to a live site with info about entertainment by Justin Tadlock, who has written a couple  of very good articles on WordPress Taxonomies, but more on that later).

What is a Taxonomy in WordPress?

By default, WordPress comes with 3 taxonomies, post tag, categories, link categories.  Essentially, a taxonomy is a way of classifying data. Typically a taxonomy will have a set of characteristics that is unique to it. To be obvious, if a taxonomy had the same characteristics as another data type, it wouldn’t be a different taxonomy! Example of those characteristics follow:

  • Post Tag: acts like a label, attached to a post.
  • Category: acts like a “bucket” in which we put posts, are often hierarchical. Posts can live in multiple categories.
  • Link Category: acts like a label, attached to a link.

Each tag or category you create is a “term” within that taxonomy. For example, if you create a category “Movies” (in our site about entertainment), “Movies” becomes a term within the category taxonomy.

Now, there are different types of movies so this is where our custom taxonomies come in. If we created a custom taxonomy “Genre”, then we could add “Action” which becomes a term in the “Genre” taxonomy. So we are classifying our movies by “Genre.”

custom-taxonomies-wordpress-diagram

Why Use Custom Taxonomies in WordPress?

In a nutshell, we use custom taxonomies to make it easier to organize our content. While you could attach an appropriate tag or set of tags to a post you aren’t really separating things out as much as you could. By separating things out in a more granular way, and giving our selves a way to classify data, we have more opportunity to display content and create relationships in various and logical ways. Let’s go back to our entertainment site for an example…

How To Use Custom Taxonomies in WordPress

To begin with, we’re likely to have our highest order of organization as our categories. Let’s assume we have Movies, Television, Books and Celebrity News as our categories.

If we think about the characteristics of movies, then assume we have created four custom taxonomies that relate to movies: Genre, Director, Actors, and Studio.

I can now enter terms into my “Genre” taxonomy such as “Action” or “Romance” (which of course become terms in the Genre taxonomy).

Understanding why this is important: We can now create a list of Movies in the “Action” genre as well as display the genre of a movie on the movie’s individual page (which also serves as a link to all movies classified as “Action”). If we had just used tags, there would be a lot of other stuff to filter through and display, not just “Action” next to the “Genre:” label which corresponds to the “Genre” taxonomy. (Make sense?). For clarity, if we just used tags how would we show what “genre” it’s in without showing all of the other tags associated with the movie? We couldn’t (effectively) since the “Action” would be just one of many tags associated with the move and we would have no way of distinguishing “genre” from “actor” since they would all be classified as “tags.” Get it!!!

One downfall, as far as I know, there is no way to cross-reference custom taxonomies (Actors with Genre e.g. show a list of movies with actor “Bruce Willis” AND genre “Action”).  I expect this will someday get remedied as people use custom taxonomies more.

Additional Reading

Below are two posts that you should read by Justin Tadlock about custom taxonomies, they are very good and give great examples and explanations of custom taxonomies. To be honest, he knows far more about this than I do and while I’ve never met the man, he’s one of those guys that has probably forgotten more about WordPress than most of us will ever know. Quite frankly, I’m only adding my $.02 because I thought a few of the concepts and some of the terms needed to be a little more “simply” explained, particularly if you are not a pretty technical WordPress user or don’t live and breathe this stuff.

In order, read:

Custom Taxonomies in WordPress 2.8

Using Custom Taxonomies to Create a Movie Database

Also visit Pop Critics to see how they are using custom taxonomies.

32 Comments

  1. MacBoy on November 5, 2009 at 6:33 am

    Good explanation. This is a tough subject to understand and explain.

    You’re right about Justin Tadlock. He knows a lot and he has an easy way of explaining the tough things to normal people!

    🙂

  2. Scott Ellis on November 5, 2009 at 3:18 pm

    MacBoy, Yeah, JT knows his stuff. Glad you found this helpful! The more I worked on trying to simplify this topic the harder it seemed to do. Hopefully if anyone still doesn’t understand they’ll ask questions (here or on Justin’s site).

    • Paul on June 11, 2013 at 7:06 am

      I read JT’s stuff before I found this, and I’ve read other stuff. I understood that it was a way to cl.assify data, but no one that I read really explained what the benifit was. I was kind of getting a glimpse but not really putting it all togetner. It’s funny how no one explains the basic concept of a lot of things in computer technology. They just assume you should understand. It’s really simple, but no one wants to give the basic simple explanation. Finally I understand the purpose of custom taxonomies.

  3. Grumpy McMurdo on December 1, 2009 at 9:30 pm

    Thanks for that Scott, it was helpful. I am also playing around with multiple taxonomies.

    Regarding the “downfall” you mentioned, i.e. “One downfall, as far as I know there is no way to cross-reference custom taxonomies” well, there is such a solution available: http://scribu.net/wordpress/query-multiple-taxonomies

    And it works like this: http://motoringscoop.com/?people=matt+halliday&places=pukekohe+park+raceway

    • Paul on June 11, 2013 at 7:08 am

      Somehow I’m not surprised. I use Roots wordpress theme for everything any more. On the Roots page he has several featured plugins. Sribu wrote more than one of them. It’s funny how certain people stand out.

  4. Scott Ellis on December 2, 2009 at 10:24 am

    Grumpy,

    Great find! I haven’t had a chance to download and play with that plugin yet but looks like it has huge potential.

    Nice looking site you have there too!

  5. Annabel on January 26, 2010 at 5:01 am

    Another super-helpful post, Scott, you've given me a good start in how to think about organizing the content on my website (my very first!).

  6. Scott Ellis on January 26, 2010 at 3:47 pm

    Annabel, you are very welcome! Let us know when you get the site up.

  7. Wordpress Taxonomies - Digital Adventures on March 14, 2010 at 10:11 pm

    […] I came across this wonderful site by Scott Ellis.  On his site I found an article on “A Basic Explanation of WordPress Taxonomies“.  It’s a cool way to categorize my site, so I will try to use taxonomies.  I fully […]

  8. Cliff on June 7, 2010 at 5:58 pm

    Thanks. I found this simple enough to give me an understanding, not only of taxonomy, but custom taxonomy as well. Keep up the good work… and I've just subscribed to your RSS feed.

  9. Scott Ellis on June 7, 2010 at 6:34 pm

    Cliff – Glad you found it helpful! If you happen to be in the area or want to come to Dallas I'll be giving an entire lecture on Categories, Tags and Taxonomies at Opencamp http://openca.mp at the end of August.

  10. […] it will definitely make the session a lot easier for you. I’d also recommend reading my post a basic explanation of WordPress Taxonomies if you aren’t already familiar with […]

  11. osu on September 15, 2010 at 1:23 pm

    Hi Scott,

    Thanks for this article, it’s an interesting read. I have a question though (and forgive me if it’s a stupid one, this is a new area of WP for me!): Couldn’t you just organise your content using categories and sub-categories to do the same thing?

    I understand the benefit of custom posts as you can create nicely formatted custom fields to attach extra details to your custom post. But taxonomies have me a bit stumped – particularly as it sounds like you’re saying a subcategory is a term of the taxonomy ‘Category’ and a tag would be a term of the taxonomy ‘Tag’ in WP early on in the article, but then you talk about custom taxonomies as being like a term of a term of a term (assuming I’ve understood correctly):

    Category (taxonomy)
    -Category called Movies (term)
    –Genre (custom taxonomy)
    —Action, Romance, Porno etc. (custom taxonomy terms?)
    –Actors (custom taxonomy)
    —Brad Pitt, Robert Redford, Dirk Diggler etc. (custom taxonomy terms?)

    I suspect I’m thinking too much in terms of organising content hierarchically while you’re probably talking in terms of grouping together data, so I thought I’d ask!
    Thanks

    osu

    ps. the name field in this comment form seems to float separately from the rest of the fields like Email and Website on my Mac using Firefox 3.6.9 0

  12. Scott Ellis on September 21, 2010 at 10:05 am

    OSU –
    You definitely “can” organize your content using categories and sub-categories but it’s not the most scaleable approach and if your content becomes expansive enough it can become very cumbersome. You also may loose some cross-relational opportunities within your content. Looking at your second paragraph I think you might be over-thinking it a bit (and I probably need to re-write some sections to make it clearer).

    However your example is right on. Action, Romance, .. are “terms” in the custom taxonomy “Genre”. “Brad Pitt” is a term in the custom taxonomy “Actors.”

    It’s easy to want to make your content very hierarchical (and to some of extent that can be appropriate) but I’ve found the flatter I keep my content and use a combination of categories & custom taxonomies, it frees me up to organize my content in a number of different ways (more flexible) without sacrificing flexibility or easy of navigation.

    Think of your categories as the “Table of Contents” for your site and Taxonomies as the index.

    For what it’s worth I’m going to be writing much more about his in the very near future so stay tuned. Lot’s to come.

    • Joel on April 25, 2011 at 1:09 pm

      Thanks for the informative article Scott. I’ve been creating websites with WordPress for about 2 years but never really used anything other than Pages. Recently, though I’ve started to experiment using Posts and last week played around with Custom Post Types and Custom Taxonomies. Needless to say, I’m a bit confused as to how they all work together.

      I’m working on a site for a pool and spa parts manufacturer and thought it would be a perfect opportunity to jump in using these new (to me at least) features, but I’m not sure what route to take setting up the Post Types and Taxonomies. Hopefully you can give me a little advice.

      They have 3 main lines of products (Pool, Spa, Hot Tub). Within these 3 main lines they have categories of products such as Pumps, Filters, and Drains. Furthermore, within say Filters, it can be further broken down into Above Ground and In-Ground. Filters can be found under all of the three main lines. My main question is, what would be the best way to set this up?

      Should I have 3 Custom Post Types, one each for Pool, Spa, and Hot Tub? Do I create a custom taxonomy for Pumps, Filters, and Drains with Above-Ground and In-Ground as terms?

      Pumps (custom taxonomy)
      Above Ground (term)
      In-Ground (term)

      Filter (custom taxonomy)
      Above Ground (term)
      In-Ground (term)

      Thanks for any light you can shed.

      • Scott Ellis on April 29, 2011 at 5:01 pm

        Joel, custom taxonomies could work but are you planning to apply them at the individual product level?
        For example, you could have a pool filter as well as a hot tub filter and if you didn’t set it up right they might not be sufficiently differentiated.

        You might make “Pool, Spa, Hot Tub” as the WP categories, “Product Type” as the taxonomy (terms: pump, filter, drain) and another taxonomy as “Ground Level” (terms, Above Ground, Below Ground).

        That is my initial thought anyway.

        Alternatively, you could make them all taxonomies . Taxonomy: TubType. Terms: Pool, Spa, Hot Tub

        To make it easier to lay things out you could have the Tub Type as both a category and custom taxonomy.

        Make sense?

  13. WordPress Taxonomies Help | Alura Web Design on November 22, 2010 at 8:07 am

    […] A Basic Explanation of WordPress Taxonomies. This entry was posted in WordPress. Bookmark the permalink. ← WordPress Books […]

  14. Dan on August 1, 2011 at 4:04 pm

    The easiest way to order the taxonomies terms, a nice plugin Advanced Taxonomy Terms Order

    • Scott Ellis on August 1, 2011 at 4:27 pm

      Interesting plugin… I’ll give it a whirl…

  15. Mark H on September 22, 2011 at 10:55 am

    One useful way you could try to use taxonomies alongside categories is where there are two differrent dimensions of data eg the movie categories you have above AND the language the movies are in.

    A taxonomies schema and navigation could be provided for one and categories used for the other.

  16. Dan on September 26, 2011 at 5:06 pm

    Here is an excellent tool as a WordPress plugin which allow to custom change the order for the terms of a taxanomy, to auto sort alphabetically, by date, posts count etc
    Advanced Taxonomy Terms Order

  17. Joshua Iniyan on December 4, 2011 at 1:10 pm

    Thank You Scott,

    Good introduction to Taxonomy.

    I’m new to this will u refer any best plugin to manage custom Post types & Taxonomy

    BTW Your site looking simply great…which font you used?

  18. […] are 5 default post types) and Tags and Categories are default Taxonomies. You can read more about Taxonomies here and Post Types […]

  19. LeahGrrl on January 5, 2013 at 3:29 pm

    I’ve been researching this for a few days now because I’m trying to create a professional learning portfolio (portfolio.EditorialPartnersLLC.com), and I’m thinking custom taxonomies will help me with organizing it. Your explanation about using categories and taxonomies together as different levels *really* helped, especially displaying it in the matrix.

    My question is whether the “terms” you have in the matrix could be another level–that is, custom post types? I’m struggling to understand the relationship between custom taxonomies and custom post types. For instance, in a matrix I’d create like the one you have above, the “terms” would become four different post types–called for my purposes “learn,” “do,” “reflect,” and “teach.”

    • Scott Ellis on February 20, 2013 at 2:01 pm

      LeahGrrl, Sorry for the delay, somehow your comment slipped through the cracks.

      To answer your question, I woud use custom taxonomies to compliment your custom post types. Taxonomies are just collections of the taxonomies and the terms within them (kind of like tags but more specific and granular). Custom post types have all the features and functionality of regular posts but are usually augmented in some way like having specific taxonomies associated with them.

      In your case you might create a custom post type for “learn” and associate the taxonomies with that are appropriate. Make sense?

  20. Janvier M on July 14, 2016 at 3:05 pm

    I have worked with WordPress since 2006 and used the Taxonomy functionality extensively, but I never took time to look at it much deeper. Recently I started coding CRUD interface for Laravel PHP framework and realized how desperately I need to WordPress Toxonomy layout. I have to code it from scratch but this tutorial is so elegantly simple my job is done by 70% already!

  21. Lance on October 24, 2016 at 5:39 pm

    Hello!!
    I’m currently building a site that has 4 categories. Work, Life, Money and Family. We have about 5 corporate partners with about 3 actual authors from each of these companies who will be writing posts on these categories. They are not restricted to just one cat. I’m killing myself trying to think about how to organize the content. My first thought was
    Category
    Partner
    Author

    But I simply made the partner the author and now I can’t
    actually show the actual person who wrote the article. Lol!! There wasn’t so much communication from the client but I won’t bore you lol.

    Would custom taxonomies work for this? Whats throwing me is these partners are all from different industries.

    Any advice would be greatly appreciated!!! Thanks!

    Lance

  22. Lance on October 24, 2016 at 5:45 pm

    Sorry. To add, maybe user taxonomies is what I’m looking for? Perhaps to group the authors under their appropriate companies.

    • Scott Ellis on October 25, 2016 at 8:06 am

      Lance,

      It sounds to me like you’re over-complicating it. Where do you want to show the author and partner info.

      They author typically has a by line, e.g. by Lance Nickel on October 25, 2016, etc…

      But it sounds to me like you want to be able to cross-reference by author and partner. How is all of that information presented to the user?

      Each author will have a page with all of the content they have contributed by default assuming they have a system login and the articles they write are assigned to them.

      If you want to create a page that shows all content by Partner you can either use a tag which will be yoururl.com/tag/partner-name or you could use a custom taxonomy which would be yoururl.com/partner-name

      Scott

      • Lance on October 26, 2016 at 9:17 am

        Hi Scott,

        Sorry for the delay and also TY for taking your time to answer. Yes I agree, I am over complicating it. I think because I keep spinning with how to organize the content/structure. I kept focusing on the url structure for SEO purposes.

        I wanted something like: mysite.com/category/partner/article

        but I couldn’t figure out how to make the partner url unless I made them an author. For that I’m using author rewrite slug

        So as it stands, the site users are just really ‘dummy’ users. The partners do not have access. We basically take the articles they write and publish for them.

        Check out this link. http://bit.ly/2eLxXC3

        You’ll see that each Category page (Life, Money, Work and Family) pull in different articles posted under that category. Like a ‘landing’ archive page of sorts. Then you click to the article. This is what I was told in the beginning then, they come to me and say well we want to show articles from the actual author. LOL! ugh. Something clickable from the post. So I found a really neat plugin, Co-Authors, which we help me add that particular author to the post and then they can have an author archive page! Almost have it working. Yay! Anyhow, sorry for the longwinded post. I appreciate you getting back and giving me some advice!!!

        • Scott Ellis on October 29, 2016 at 1:02 pm

          Lance,

          Not sure how much further I can help you here. That exact URL structure may be tough to accomplish. More important, I’m not really sure what the benefits are in that case. You can certainly accomplish all the inter-linking, but it may not be exactly reflected as /category/partner/article

          I wouldn’t recommend architecting your content specifically to accomplish a URL structure. Set it up to accomplish your goals, link internally as appropriate, use categories/tags/taxonomies as necessary and let the rest take care of itself.

Leave a Comment