PHPMatters Help You Better Hosting Your PHP-based Sites
How to Create WordPress Custom Taxonomies

How to Create WordPress Custom Taxonomies

When using WordPress for website building, the majority of users can leverage its functions of posts, pages, categories, plugins and themes without much hassle. However, when it comes to the custom taxonomies, many people just feel confused.

In fact, this is a grouping mechanism introduced since the WordPress version 3.0 as one of the core features. In the following, we’d like to come out the detailed guidance about this WordPress terminology, telling you what it is and how to create WordPress custom taxonomies.

Things You Need to Know about WordPress Taxonomies

In fact, the WordPress taxonomy is used as a way to group your posts together based on some other principles but not just categories and tags. With it, you can have your contents structured in a free, well-organized and logical manner.

In fact, this feature is already utilized by many WordPress users, but they are not aware of that. For instance, you may use the Categories to sort your blog posts into multiple groups and use the Tags to add more divisions for your articles.

WordPress Taxonomies

Categories and Tags are the commonly used taxonomies. Besides these, WordPress also has other two default options – Link Category and Post Formats.

  • Link Category – This special WordPress taxonomy is used to group your links. Generally, it is used to define the group of links to be showcased in the sidebar.
  • Post Formats – This is an enhanced feature for WordPress taxonomies, which is introduced since the version 3.1. With it, you can add the special meta information to your theme for the customization of post presentations.

Now, in addition to the 4 in-build taxonomies, WordPress also allows you to group your posts using your custom taxonomies. The WordPress core developers have already added the function of register_taxonomy() for handling this task.

Create WordPress Custom Taxonomies with the Plugin

To create the WordPress custom taxonomies, the easiest method is to use the Simple Taxonomy plugin. After installing it using your WordPress admin, you can find the Custom Taxonomies button from the Settings drop-down menu. Click it to enter the settings page of this plugin.

In this page, you can find the area named as “Add a New Taxonomy”. After choosing and filling out all the values of this area, you can have your WordPress custom taxonomies created with ease.

Main Information

First of all, you should decide the name of your custom taxonomy. Here, you should mention that all the characters need to be low-cased.

After that, you need to decide the hierarchy. If you want your taxonomy to work in a way similar to categories with parent items and child items, you can set the value to True. Otherwise, if you set the value of False, your taxonomy will work like tags with more freedom.

As for the post types, unless you have some specific requirements, we highly recommend you to choose all the listed items including your custom post types. This can group your contents in a comprehensive manner.

Lastly, you are required to decide whether to add the terms automatically. Personally, we suggest you choosing the None value.

Main Information

Visibility and Translations Wording

If you want your taxonomy queries to be performed in the front webpages, you can set the value of Public to True. Otherwise, set it to False. Here, if you already have added the search box in your website, you’d better not to publicize your custom taxonomies.

As for the translation wording, this section decides how your taxonomy will be displayed in the WordPress dashboard. For instance, the Post Terms decides the name of your taxonomy that is showcased in the drop-down menu of Posts and the meta box in the post editing page.

Visibility and Translations Wording

As for the rest options, you need to try them on your own based on the display of your WordPress dashboard. Never mind, the process is quite easy.

Besides, in the right side of the whole setting screen, you can find the configurations for Rewrite URL, Administration and Permissions of this taxonomy. Here, you’d better set the value of Rewrite to True, so that a nice URL for your taxonomy can be built automatically. As for the rest configurations, simply leave them unchanged.

Now, you only need to click the Add Taxonomy button, and your WordPress custom taxonomy is created successfully. Therefore, when editing your posts or pages, you can find a newly-created meta box for content grouping, right below the Categories box and Tags box by default.