Header Text - WordPress Taxonomy: Overview & Custom Creation

According to WordPress Codex, “taxonomy” refers to a method of grouping similar content meaningfully, which means you can use it to group your content based on some shared characteristics.

For instance, if someone starts a blog about computer programming, they will probably group their posts by topics like “web development”, “programming languages”, or “software tools”. Then “programming languages” can be further categorized into Java, Python, etc.

Organizing your website’s content using taxonomies is important because it improves user navigation. When content is well-organized, it’s easier for people to find what they’re looking for; this keeps them on your site longer. Also, using taxonomies properly can help search engines understand your site’s structure, boosting your SEO and making it more visible in search results.

While the word “taxonomy” originates from biology, in this tutorial, we focus on something different – WordPress Taxonomy. We discuss what it means, when to use a taxonomy and how to create a taxonomy (a custom one) via coding and plugins.

Default WordPress Taxonomies

WordPress comes with 4 default taxonomies:

  1. Categories
  2. Tags
  3. Post Formats
  4. Link Category.

Each taxonomy serves a specific purpose and helps organize content differently, providing users and search engines with a clearer website structure.

Categories

This WordPress Taxonomy is used to group posts under broad topics. They are hierarchical, meaning you can create parent categories with subcategories under them. For example, a blog about food could have main categories like “Recipes” and subcategories like “Breakfast” or “Desserts”.

These categories are typically displayed on the front end of your site to help users navigate your content. They can also affect your posts’ permalink structure (e.g., /category/recipes/). Furthermore, categories also create dedicated archive pages that show all posts within that group.

When you create a new post, WordPress automatically assigns it to Uncategorized if no other category is selected, but you can change this in Post Editor at any time.

WordPress Taxonomy - Change Category

However, if you don’t find your desired category, you can create it in one of the following 2 ways:

The first way is to log into your WordPress dashboard. Go to Posts and select Add New Post (or edit an existing post). Once you’re in Post Editor, find Categories on the right-hand sidebar. Now, click Add New Category.

WordPress Taxonomy - Add New Category

Enter the new category name and, if needed, choose a parent category. Then, click Add New Category, and it will be applied to the post. This method allows you to create categories on the fly while working on your post.

WordPress Taxonomy - Add New Category

In the second method, you manage categories separately from the Post Editor. In this case, navigate to the WordPress DashboardPostsCategories page.

WordPress Taxonomy - Access Categories Page

Provide your category name, a slug (optional), and choose a parent category if you want a subcategory. You may also add an optional description, which can be displayed on some WordPress themes. Finally, click Add New Category to save it. This method is helpful when you want to add or organize multiple categories before assigning them to posts.

WordPress Taxonomy - Add New Category via Categories Page

Both methods allow you to create and manage categories, giving you flexibility depending on how you prefer to organize content.

Tags

Tags are another built-in WordPress Taxonomy, but they work differently from categories. They are non-hierarchical, meaning there’s no parent-child relationship between them.

Tags are best for more specific details within a post and allow you to label posts with keywords or phrases relating to the content. For example, a recipe post under the “Desserts” category might have tags like “chocolate”, “cake”, or “pudding”.

These are useful when users filter posts by precise details or topics. Unlike categories, WordPress tags are optional and can be added freely to any post. However, avoid adding unnecessary tags, as these can clutter your website.

There are 2 main ways to add tags in WordPress: Using Post Editor and Tags Page.

In the first method, you can add tags directly while creating or editing a post. Once in the editor, locate the Tags box (usually below the Categories section) on the right-hand sidebar. Type the tags you want to use, separated by a comma or the Enter key.

WordPress Taxonomy - Add Tags Using Post Editor

This method allows you to add tags quickly while writing or editing a WordPress post. However, if you want to create tags for future use, you can add and manage them separately through the Tags page on the dashboard.

To do this, navigate to Posts Tags on your dashboard.

WordPress Taxonomy - Access Tags Page

Now, you’ll see Add New Tag, where you can specify the tag’s name, a slug (optional), and an optional description. Once you’ve filled in the details, click Add New Tag to save it. You can then apply this tag to any post later.

Remember, the slug is the URL section that identifies the tag’s archive page. When creating a tag, specify a value for the Slug field if you want to control the tag’s URL structure (e.g., /tag/your-tag-name), especially if you have specific SEO or readability goals.

WordPress Taxonomy - Add Tag Using Tags Page

This method is useful if you want to predefine tags before creating posts or if you want to organize your tags ahead of time. Once you’ve added tags using either method, they can be reused on any post. When editing a post, start typing in the tag box, and WordPress will suggest existing tags for you to select.

Remember, categories are required for every post in WordPress, while tags are optional. Each post must be assigned at least one category; otherwise, WordPress will place it in the Uncategorized category by default.

Important:

In WordPress Taxonomy, a term refers to an individual item or label within a taxonomy that is used to categorize or tag content. A “term” is the name (or names) you assign within a taxonomy to organize your posts or custom post types. In the Category taxonomy “Recipes”, for instance, terms can be “Lunch” and “Dinner”. However, In the Tag taxonomy, terms may be “Vegan”, “Gluten-Free”, or “Low-Carb”.

Post Format

This WordPress Taxonomy allows you to categorize posts based on what type of content they contain. WordPress supports formats like Aside, Gallery, Quote, Audio, and Video. You will find this setting on the right-side panel of your Post Editor.

WordPress Taxonomy - Choose Post Format

This is a lesser-known WordPress Taxonomy, primarily used to organize external links into categories. If you have a section of your website that includes links to other sites or resources, you can group those links using link categories.

This helps keep external resources organized, especially if you maintain a blogroll or a resource page. Although this taxonomy isn’t used as widely as categories and tags, it can be handy for organizing external links.

All these default taxonomies—Categories, Tags, Link Categories, and Post Formats—play a critical role in helping WordPress users organize content effectively. Use these to create a well-structured, easy-to-navigate website that enhances user experience and Search Engine Optimization.

Important:

The Categories and Tags taxonomies are visible to your audience. However, the Post Format and Link Category are not usually visible to visitors.

When to Use WordPress Custom Taxonomy

While WordPress provides default taxonomies like Categories and Tags, custom taxonomies offer more flexibility for organizing content beyond built-in options. They are useful when you have a specific type of content that requires a unique organizational structure.

By creating custom taxonomies, you can group posts or custom post types in ways that fit your website’s unique requirements. Custom WordPress Taxonomy also helps improve navigation, making it easier for visitors to find related content. It also improves your site’s SEO by giving search engines more context about your content.

For example, for a food blog, you might create custom taxonomies like “Cuisine Type” (e.g., Italian, Chinese) or “Dietary Preferences” (e.g., Vegan) to organize recipes so visitors can filter by these specific attributes.

Also, on a real estate website, custom taxonomies like “Property Type” (e.g., Apartment, House, Commercial) and “Location” can help users easily find properties that fit their needs.

Now that you know what a WordPress taxonomy is, how many default taxonomies are available, and when to use a custom taxonomy, it’s time to learn how to create one.

How to Create a Custom WordPress Taxonomy

There are 2 main methods to create custom taxonomies in WordPress: Using a plugin (which is user-friendly for beginners) and adding code to your WordPress theme’s functions.php file (ideal for developers).

Use a Plugin to Create a Custom Taxonomy

The easiest way to create a custom taxonomy is with the Custom Post Type UI plugin. This method requires no coding and can be done directly from the WordPress dashboard. However, to use this approach, you first need to install this plugin. Once you’ve successfully installed and activated it, go through the following steps:

Click on CPT UI and select Add/Edit Taxonomies.

WordPress Taxonomy - Add or Edit Taxonomies

In the field Taxonomy Slug, enter a unique name (e.g., “cuisine”). If the taxonomy includes multiple words, the slug must be in lowercase letters separated by a hyphen. In the Plural Label and Singular Label fields, add names for your taxonomy (e.g., “Cuisines” and “Cuisine”).

Then, choose which types of posts the custom taxonomy should apply to. In our case, we attached it with Posts and Pages. Lastly, click Add Taxonomy.

WordPress Taxonomy - Use Plugin to Create Custom Taxonomy

Now, you’ll see your new taxonomy in the right panel of your Post Editor, which, in our example, is Cuisines:

WordPress Taxonomy - Locate Custom Taxonomy

You may notice that the new WordPress Taxonomy is a tag. It’s fine if it meets your requirements. However, if you want to create a category instead, go to CPT UIAdd/Edit Taxonomies. Switch to the Edit Taxonomies tab and ensure you select the correct WordPress Taxonomy.

WordPress Taxonomy - Edit Taxonomies

Scroll down to Settings and set Hierarchical to True.

WordPress Taxonomy - Enable Parent-Child Relationship

Now, scroll down further and click Save Taxonomy.

WordPress Taxonomy - Save Taxonomy

Lastly, go back to the Post Editor. You’ll now be able to choose the parent-child relationship as follows:

WordPress Taxonomy - Add Custom Category Taxonomy

This plugin lets you easily create custom taxonomies without touching any code, so it’s a great option for non-developers. However, if you’re a developer or comfortable with coding, you can use the following approach.

Add Code to functions.php to Create Custom Taxonomy

Developers who prefer to create custom taxonomies manually can add code to the functions.php file. This method offers more flexibility and customization. Here’s how to do that:

First, go to WordPress DashboardAppearance Theme File Editor. Then, click the functions.php file under the Theme Files menu.

WordPress Taxonomy - Open functions.php File

Once the file is opened, add the following code to create a hierarchical taxonomy:

// Function to create a custom hierarchical taxonomy called "Cuisine"

function create_custom_taxonomy() {

    // Define the labels that will be displayed in the WordPress admin area

    $labels = array(

        'name'              => _x( 'Cuisines', 'taxonomy general name' ),

        'singular_name'     => _x( 'Cuisine', 'taxonomy singular name' ),

        'search_items'      => __( 'Search Cuisines' ),

        'all_items'         => __( 'All Cuisines' ),

        'parent_item'       => __( 'Parent Cuisine' ),

        'parent_item_colon' => __( 'Parent Cuisine:' ),

        'edit_item'         => __( 'Edit Cuisine' ),

        'update_item'       => __( 'Update Cuisine' ),

        'add_new_item'      => __( 'Add New Cuisine' ),

        'new_item_name'     => __( 'New Cuisine Name' ),

        'menu_name'         => __( 'Cuisines' ),

    );

    // Define the arguments that configure how the taxonomy behaves

    $args = array(

        'hierarchical'      => true, // Set to 'true' to make this taxonomy hierarchical, like categories

        'labels'            => $labels,

        'show_ui'           => true, // Show the UI for managing this taxonomy in the admin area

        'show_in_menu'      => true, // Show in WordPress admin menu

        'show_in_nav_menus' => true, // Available in navigation menus

        'show_admin_column' => true, // Show as a column in post list view

        'query_var'         => true, // Enable querying via taxonomy slug

        'rewrite'           => array( 'slug' => 'cuisine' ),

        'show_in_rest'      => true, // This makes it available in the block editor (Gutenberg)

    );

    // Register the taxonomy to associate it with the 'post' post type

    register_taxonomy( 'cuisine', array( 'post' ), $args );

}

// Hook the custom taxonomy function to WordPress' 'init' action

add_action( 'init', 'create_custom_taxonomy', 0 );

After adding the code, save the functions.php file. Your custom hierarchical taxonomy will now appear under WordPress DashboardPosts and can be assigned to posts via the Post Editor. This method is perfect for developers who need more control over how taxonomies function on their site.

You may change the hierarchical value to false while defining the arguments if you want the taxonomy to behave like tags rather than categories. Here’s what the code will look like:

// Function to create a custom hierarchical taxonomy called "Cuisine"

function create_custom_taxonomy() {

    // Define the labels that will be displayed in the WordPress admin area

    $labels = array(

        'name'              => _x( 'Cuisines', 'taxonomy general name' ),

        'singular_name'     => _x( 'Cuisine', 'taxonomy singular name' ),

        'search_items'      => __( 'Search Cuisines' ),

        'all_items'         => __( 'All Cuisines' ),

        'parent_item'       => __( 'Parent Cuisine' ),

        'parent_item_colon' => __( 'Parent Cuisine:' ),

        'edit_item'         => __( 'Edit Cuisine' ),

        'update_item'       => __( 'Update Cuisine' ),

        'add_new_item'      => __( 'Add New Cuisine' ),

        'new_item_name'     => __( 'New Cuisine Name' ),

        'menu_name'         => __( 'Cuisines' ),

    );

    // Define the arguments that configure how the taxonomy behaves

    $args = array(

        'hierarchical'      => false, // Set to 'false' to make this taxonomy non-hierarchical, like tags

        'labels'            => $labels,

        'show_ui'           => true, // Show the UI for managing this taxonomy in the admin area

        'show_in_menu'      => true, // Show in WordPress admin menu

        'show_in_nav_menus' => true, // Available in navigation menus

        'show_admin_column' => true, // Show as a column in post list view

        'query_var'         => true, // Enable querying via taxonomy slug

        'rewrite'           => array( 'slug' => 'cuisine' ),

        'show_in_rest'      => true, // This makes it available in the block editor (Gutenberg)

    );

    // Register the taxonomy to associate it with the 'post' post type

    register_taxonomy( 'cuisine', array( 'post' ), $args );

}

// Hook the custom taxonomy function to WordPress' 'init' action

add_action( 'init', 'create_custom_taxonomy', 0 );

Important:

If you’re using the Gutenberg Block Editor, the taxonomy might not show up in the post editor unless the ‘show_in_rest’ argument is set to true. This argument is essential for REST API support, which the Block Editor requires.

Strip Banner Text - Streamline your site’s performance with Hosted.com’s WordPress Hosting. [Get started]

KEY TAKEAWAYS

  1. A WordPress Taxonomy helps organize your content, which makes it easier for visitors to navigate your website.
  2. Categories and tags are built-in taxonomies, but custom taxonomies offer more flexibility.
  3. Custom taxonomies are useful for websites with unique content, such as recipes or portfolios.
  4. You can create custom WordPress Taxonomies using plugins or if you add code to your theme’s functions.php file.
  5. Custom taxonomies enhance site organization and boost SEO by helping search engines un derstand your website’s content structure.

FAQs

What is website taxonomy in WordPress?

A taxonomy in WordPress is a way to group or classify content. Categories and tags are common taxonomies, and they help organize your posts so visitors can find related content easily.

How are categories and tags different in WordPress?

Categories are broader and can have subcategories. Tags are more specific and describe details about the post. Both help organize content but in different ways.

Why should I create a custom taxonomy?

Custom taxonomies help you organize unique content. For example, a movie review site might use custom taxonomies like “Genre” or “Director” to categorize posts better.

Can I use plugins to create custom taxonomies?

Yes, using plugins like “Custom Post Type UI” is the easiest way to create and manage custom taxonomies without needing any coding.

Where will I find custom taxonomies in my WordPress dashboard?

Once created, custom taxonomies will appear in your post editor, just like categories or tags. You can assign them to posts and organize content more efficiently.

How to Fix WordPress Stuck In Maintenance Mode

WordPress Blocks Features and Site Customization Options

WordPress Widgets: How To Add & Use Them For Maximum Impact

WordPress Admin Dashboard: Tips for Accessing & Using WP Admin

Migrate A Website To WordPress From A Different CMS