How to Create Custom Taxonomy in WordPress

by Vincy. Last modified on July 12th, 2022.

Taxonomy is a feature to group content like posts, and links in a structured way. For example, category and tag are the inbuilt taxonomies in WordPress to group posts. The category is a hierarchical taxonomy and the tag is an example of non-hierarchical taxonomy.

WordPress allows us to create custom taxonomies. It can be either hierarchical or non-hierarchical. It is introduced in version 2.3. Here we are going to see how to create a custom taxonomy in WordPress.

Register Custom Taxonomy

There is a function named register_taxonomy() to add and register our own custom taxonomy in WordPress. We have to hook this function to the init action in functions.php

Here is an example code for creating a custom hierarchical taxonomy named Awards. The value we are giving in the slug option will be used in the taxonomy page URL. And the code is,

 * creating the custom taxonomy named 'Awards'
function create_custom_taxonomy() {
	register_taxonomy('awards', 'post', array(
		'labels' => ( 'Awards' ),
		'rewrite' => array(
			'slug' => 'awards', 
			'hierarchical' => true 
add_action( 'init', 'create_custom_taxonomy', 0 );

Taxonomy Terms

We can add more groups under taxonomy. These are called taxonomy terms. In this example, we are registering the custom taxonomy for a post. So we can see this under post menu in WordPress Admin. The screenshot is,


By using this menu, we can navigate to the page to add new terms to this custom taxonomy. This screenshot shows the page to manage custom taxonomy terms.


Written by Vincy, a web developer with 15+ years of experience and a Masters degree in Computer Science. She specializes in building modern, lightweight websites using PHP, JavaScript, React, and related technologies. Phppot helps you in mastering web development through over a decade of publishing quality tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *

↑ Back to Top

Share this page