fbpx

Taxonomies in WordPress: The EPIC Tutorial

What are taxonomies in WordPress? How are they beneficial to users?

As a WordPress user, you may have asked the above questions before.

Or, you may have seen the term in some sections of certain plugins like Yoast.

Whatever the case, you’ll understand the term better in this article.

What Are Taxonomies In WordPress?

The term Taxonomy has its origin in Biology and it means “classification of organisms”.

Having this background knowledge or history of the term would help you to understand what it means as it relates to WordPress.

In WordPress, Taxonomy is any systematic way of grouping or classifying content.

To illustrate, imagine a smartphone shop – where phones are sold. There could be different subsections of that store based on the brand of smartphone, price, specification, etc.

As a buyer, you walk into the store and you know exactly where to go to get what.

For example, if I want a Samsung smartphone, I would go straight to any of the sections of the store where “Samsung” is labeled.

The point here is this: the idea of grouping those smartphones by whatever yardstick is known as taxonomy as it applies to WordPress.

Importance of Taxonomies in a Blog

As mentioned above, taxonomies help to classify content based on whatever criteria.

This makes it easy for readers to find content on a WordPress site.

Furthermore, taxonomies give a WordPress site a better structure. Hence, Search Engines would understand such websites better, and so would human readers.

Further Reading: Website vs Blog – The Difference

Types of Taxonomies

By default, WordPress has just two types of Taxonomies. They are:

  • Tags
  • Categories

In essence, Tags and categories are subsets of taxonomies.

Imagine taxonomy to be a laptop. Dell and HP are like Tags and Categories.

For a more in-depth understanding of the difference between Tags and Categories, read my comprehensive breakdown here.

How To Create Custom Taxonomies In WordPress

On a WordPress site, Tags and Categories come by default. However, you can choose to have other types of taxonomies beyond tags and Categories.

In other words, you could create custom Taxonomies on your WordPress site if you so wish.

There are two ways to create custom taxonomies in WordPress:

  • With Code
  • Plugin

If you prefer learning from videos, watch this video to learn how to create custom taxonomies on your WordPress site:

Just in case you prefer reading, let’s continue.

Create Custom Taxonomies With Code

Follow the steps below to create custom taxonomies on your WordPress site. But before then, copy the code below and then continue.


//hook into the init action and call create_book_taxonomies when it fires
  
add_action( 'init', 'create_subjects_hierarchical_taxonomy', 0 );
  
//create a custom taxonomy name it subjects for your posts
  
function create_subjects_hierarchical_taxonomy() {
  
// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI
  
  $labels = array(
    'name' => _x( 'Subjects', 'taxonomy general name' ),
    'singular_name' => _x( 'Subject', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Subjects' ),
    'all_items' => __( 'All Subjects' ),
    'parent_item' => __( 'Parent Subject' ),
    'parent_item_colon' => __( 'Parent Subject:' ),
    'edit_item' => __( 'Edit Subject' ), 
    'update_item' => __( 'Update Subject' ),
    'add_new_item' => __( 'Add New Subject' ),
    'new_item_name' => __( 'New Subject Name' ),
    'menu_name' => __( 'Subjects' ),
  );    
  
// Now register the taxonomy
  register_taxonomy('subjects',array('books'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'subject' ),
  ));
  
}
  • Install and activate WPCode snippet
  • Add new snippet
  • Select PHP Snippet for Code type.
  • Paste the above code in the code section and save.

Read Also: How to get Free Professional Email Address

Create Custom Taxonomies With A Plugin

Follow these steps to create custom taxonomies with a plugin on your WordPress site.

  • Install and activate the plugin Custom Post UI
  • Go to add/edit Taxonomies in the Plugin settings
  • Create your taxonomy slug
  • Create the plural label
  • Create the singular label
  • Auto-populate labels
  • Choose hierarchical settings in the taxonomy options
  • Add taxonomy to save.

Again, if you are not clear with any of the instructions, watch the video tutorial here:

Final Thought

Taxonomies are good for any WordPress site as they help to classify or group similar content. This is very much helpful to readers and Search Engines.

Remember that the two default WordPress taxonomies are tags and categories. Again, understand the difference between the two here.

If for any reason you want more than tags and categories, the detailed instruction above should help you create a custom taxonomy either with codes or a plugin.

If you found this article helpful, why not share it? Also, you could find out 27 YouTube Channels to learn SEO, how to run profitable Facebook ads, and why WordPress is free to use.

Leave a Comment