April 13, 2021

WordPress taxonomy allows you to group posts that have something in common. In most cases, this is some property, category, or a post topic.

WordPress has two built-in taxonomy types: Categories and Tags. You can also create custom taxonomies.

There are two types of custom taxonomies in WordPress:

  • Hierarchical – similar to the built-in post Categories taxonomy. It includes a parent/children relationship. You use a checkbox to select one of the available taxonomy terms or type in the name of a new term you want to create.
  • Flat – similar to the built-in Tags taxonomy. You type in the text to enter the term.

For example, if you have a directory site that lists software, you can use hierarchical taxonomy to select a required operating system. The following image displays an example of such taxonomy.

Selecting terms in a hierarchical taxonomy
Selecting terms in a hierarchical taxonomy

You can also use a flat taxonomy so users can tag each car with terms they simply type in.

Adding terms to a flat taxonomy
Adding terms to a flat taxonomy

Creating a new custom taxonomy involves editing the theme’s functions.php file. Assigning a taxonomy to a specific custom post type requires adding even more code to the theme’s functions.php file.

Adding Custom Taxonomy without using PHP

With Toolset, you can create a custom taxonomy right from the WordPress admin. After creating it, you can assign it to one or more custom post types.

Adding Custom Taxonomy
Adding Custom Taxonomy

You can even change your theme and your taxonomy and its terms will stay available. This is not the case with taxonomies defined in your theme’s functions.php file.

Take our free course on WordPress custom post types, fields and taxonomy. You’ll learn why WordPress added custom post types, fields and taxonomy and how they can help you build advanced sites.