WordPress users must be familiar with the concept of content type classification using Categories or Tags. These things also are called Taxonomy. So what is Taxonomy? Simply, it gives you various options for classifying new content types. This article will introduce you to the process of creating a custom taxonomy that stores additional custom content types without mixing them with Categories or Tags.

Creating custom taxonomy using codes

Step 1: Examining a general implementation for Taxonomy creation in WordPress

Taxonomy uses ‘init’ hook to hooks a custom function which contains the register_taxonomy() functions. This function has two arguments: $label and $arr, similar to the function used to create custom post type but much easier. The hook and function structures are as follows:

function custom_taxonomy() {
    $label = array(
    $arr = array(

    register_taxonomy('product-type', 'post', $arr);
add_action( 'init', 'custom_taxonomy');

In which:

  • $label: contains parameters which determine the display name of the taxonomy.
  • $arr: contains various parameters of the taxonomy.
  • register_taxonomy() is used to register the taxonomy and has three parameters: slug, post type (other post types such as page, custom post types are also valid parameters) and other parameters contained by $arr.

Finally, hook the custom_taxonomy() to the ‘init’ action hook.

Step 2: Creating a functional and simple custom taxonomy

function custom_taxonomy() {
    /* $label contains parameters determining the Taxonomy’s display name
    $labels = array(
        'name' => 'Products',
        'singular' => 'Products',
        'menu_name' => 'Products'\

    /* $args declares various parameters in the custom taxonomy
    $args = array(
        'labels' => $labels,
        'hierarchical' => false,
        'public' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'show_in_nav_menus' => true,
        'show_tagcloud' => true,

    /* register_taxonomy() to register taxonomy
    register_taxonomy('product-type', 'post', $args);

// Hook into the 'init' action
add_action( 'init', 'custom_taxonomy', 0 );

In the list of parameters declared by $args, there is a parameter named “hierarchical“. if you set it TRUE, the custom Taxonomy can have a kind of mother-child hierarchy as a category. Otherwise, when “hierarchical” is set to FALSE, it behaves like Tags.

Look at what you achieved:

Results when creating custom taxonomy by code
Results when creating custom taxonomy by code

That’s totally done. You can now create terms for the custom taxonomy when making a new post.

Custom taxonomy created to categorize posts
Custom taxonomy created to categorize posts

This is one way to create custom taxonomy in WordPress using code. But what if you’re not confident in your ability to code it yourself or looking for an even simpler method? Fear not since WordPress also allows users to create custom taxonomy using plugins.

Creating a custom Taxonomy using MB Custom Taxonomy plugin

Step 1: Install and activate plugins

Before getting started, we need to install and activate 2 below plugins:

After installing and activating them, a new menu will appear in the admin dashboard.

Admin dashboard now has a menu named Meta Box
Admin dashboard now has a menu named Meta Box

Step 2: Create a new Taxonomy

Go to tab “Taxonomies” inside the “Meta Box” tab, then press “Add New”.

Creating a new Taxonomy
Creating a new Taxonomy

A new one will appear on your screen. Move on.

Step 3: Configure your custom Taxonomy

Fill the fields with the information you want.

Configure the taxonomy
Configure the taxonomy

I am going to create a taxonomy named Menu Products whose slug is menu-products. This slug will be used to get data later.

Be aware that in the Generate Code section, leave everything by default and don’t change anything.

In the Assign To Post Type section, assign your custom taxonomy to the desired post type. In our example, since we don’t have any post type named Product, we choose Post.

assign the taxonomy to a post type

Step 4: Save and finish

Save your newly created taxonomy to complete the creation process in WordPress.
After saving your taxonomy, you will see a block of codes that was automatically generated. It can be achieved by coding it yourself or by using the plugin.

The automatically generated codes after saving your custom taxonomy

The automatically generated codes after saving your custom taxonomy
The automatically generated codes after saving your custom taxonomy

And here’s the result:

Result of creating a custom Taxonomy using the MB Custom Taxonomy plugin
Result of creating a custom Taxonomy using the MB Custom Taxonomy plugin

This is a simple method for creating your own taxonomy without the hassle of learning how to code. Just install the plugin and follow the steps. It’s pretty quick, easy and simple.

Final words

This article provides a general view on Custom Taxonomy creation through codes and MB Custom Taxonomy plugin. We hope that readers find this article useful.

If there’s any question or opinion you would like to submit, please do so below. Thank you for reading.

Leave a Reply

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


Subscribe to our newsletter to receive news and tutorials for Meta Box and WordPress.

grid gear info copy caret-up caret-down trash