Taxonomy is the practice and science of classification. The original meaning of the term was in biology, in which it described the practice of classifying organisms with similar properties into groups. However, the use of the terms is much more widespread now and is very much part of the WordPress terminology.
In WordPress, a taxonomy is a means of classifying content. Taxonomies enable you to group things together in specific ways. This makes them extremely useful for organising your content and creating your site’s navigation.
Each item within a taxonomy is a term. This means that:
- The taxonomy name is the way you are classifying content
- The individual terms are properties belonging to the content being classified
The Default Taxonomies
The taxonomies that you’ll be most familiar with are categories and tags:
- The Category taxonomy lets you group things together in a hierarchical manner. This lets you create hierarchical content structures and navigation across your website. A useful analogy is to think of it as creating your table of contents.
- Tags is a non-hierarchical taxonomy. It’s often used to tag the content with specific topics that are being discussed. A useful analogy is to think of it as creating your index.
Custom Taxonomies are custom ways of organising your content. They break you free from the restriction of using categories and tags for organisation. If you are using a theme or plugin that makes use of Custom Post Types, it’s very likely that you’ll see a Custom Taxonomy accompanying it.
Using Custom Taxonomies
To make this clearer, let’s look at an example.
Imagine that you want to create a recipe website. You create a Recipes Custom Post Type for storing all of your recipes. Now you need to classify this information. You do this in two ways:
Hierarchical Taxonomy: Cuisine
This hierarchical taxonomy lets you organize your recipes by cuisine, grouped together under regions.
Non-hierarchical Taxonomy: ingredient
This non-hierarchical taxonomy lets you create an index of recipes with the same ingredients; e.g. potatoes, cumin, pasta, beef, turkey, etc etc.
Other examples of uses for custom taxonomies are:
- Brands to organise Products
- Vehicle to organise Automobiles
- Job Type to organise Testimonials
- Event Type to organise Events
Creating Custom Taxonomies
As with Custom Post Types, Custom Taxonomies are registered either in the
functions.php file of your theme, or using a plugin. There is information in the WordPress Codex on how to do this.
With Pods, you can easily make Custom Taxonomies and associate them with any post type in WordPress. This increases the flexibility of the navigation and organizational structure of your website.
- How do I decide between a Custom Taxonomy or a Custom Post Type?
If your item (taxonomy or CPT) can stand alone by itself as a page of detail, it should be a CPT. If it can only exist as a group of things, it’s a Custom Taxonomy.
For instance, I don’t feel Authors is a Custom Taxonomy of Books. They’re both Custom Post Types and related to each other because they stand alone as unique items.
However, Genre is a Custom Taxonomy, because while you can define it, give it a featured image, a color on your website, a nice description and an icon, it doesn’t exist on it’s own without a list of books or authors in that Genre.