Resources

What are Taxonomies in WordPress?

Are you using taxonomies in WordPress properly?

Do you have too many categories, or are you worried you add too many tags to your posts?

Plus, what other taxonomies are available?

We cover all of this and more in this post dedicated to all taxonomies available for WordPress.

Inside this article

    What are Taxonomies in WordPress?

    WordPress taxonomies provide a simple way for you to group related posts together so your readers can find posts with similar topics more efficiently. The two default taxonomies in WordPress are categories and tags, and they can only be assigned to blog posts.

    You’ll find a simple example of how WordPress categories are used right here on our blog. Hover over the Categories item in our menu to see which primary topics we cover on Design Bombs.

    If you log into the backend of your own WordPress site and hover over the Posts item in the admin menu to the left, you’ll find four submenu items, two of which are Categories and Tags.

    All WordPress sites have a default category called “Uncategorized” that you cannot delete. This is because it’s the default category every post you create will be assigned to if you don’t assign it to one yourself.

    Fortunately, you can change the name of this category. Just hover over it, and click Edit or even Quick Edit.

    You’ll find four options you can configure when you edit or create a new category:

    1. Category Name – User-friendly name for your category. This is how your category will appear on the frontend of your site.

    This means it’s best to use “WordPress Plugins,” “WordPress plugins” or even “wordpress plugins” and not “wordpress-plugins” or “wordpressplugins.”

    2. Category Slug – Controls the way your category name appears in URLs. For instance, the URL for our “WordPress Plugins” category is designbombs.com/category/wordpress-plugins.

    Use all lowercase letters here, and use hyphens “-” to separate words instead of spaces. So, enter “wordpress-plugins” and not “wordpress plugins” or “wordpressplugins.”

    3. Assign Parent Category – WordPress categories can have hierarchies several levels deep. The first categories you create are “parent categories,” and you can break these down into “child categories,” “grandchild categories,” and so on, and so forth.

    We have two separate parent categories for WordPress plugins and WordPress themes here at Design Bombs, but we could also create a parent category called “WordPress” and two child categories called “WordPress Plugins” and “WordPress Themes.”

    4. Category Description – Provide a brief description of your category and the topics your reader can find in it. Some themes display this description on your category page, so it’s best to include it.

    The Add New Tag interface is more or less the same, but it’s much more convenient to create tags on the fly in the post editor.

    From here, you can assign categories to your post by selecting them in the Categories section in the sidebar to the right.

    For tags, simply enter the name of a tag you want to assign to an article, and hit Enter.

    Use title case or all lowercase letters, and separate words with spaces.

    WordPress Categories vs WordPress Tags

    Two of the most common questions new WordPress users have in regards to WordPress taxonomies are what the differences between WordPress categories and tags are and how to use WordPress categories properly.

    To put it plainly, you should use categories for broader topics and tags for specific topics. This is easier to understand when you know how to use categories properly.

    Let’s use a book blog as an example. It’s best to use as few categories as possible where each parent category represents a primary topic you cover on your blog. For a book blog, these could be broad book genres the blog covers:

    • Fantasy
    • Classics
    • Horror
    • Young Adult

    You can then break these primary categories down into subcategories. These would be subgenres for a book blog. So, child categories we could assign to our parent category Fantasy could include “High Fantasy,” “Low Fantasy,” “Dark Fantasy,” “Magical Realism,” and so on.

    Two levels deep is enough of a hierarchy for most blogs, but you can break your child categories down as much as you like.

    But how do tags fit into this structure? WordPress tags should be used for specific topics you cover frequently on your blog but not frequently enough to turn into categories.

    For our book blog example, we could create tags for specific authors, books, book stores, book terms like “foreshadowing,” and more. So, if a book blogger publishes a post about a Harry Potter topic, they could assign a variety of different tags to it, including “Harry Potter” and “J.K. Rowling.”

    There are also differences in the way you use WordPress categories and tags on the frontend. Generally, you use categories in your menu as a way to give your readers easy access to the broader topics your blog covers, like we did in our menu.

    You can also list categories in your sidebar, footer and any other widget areas on your site.

    You’ll also notice some blogs showcase whatever category a post is assigned to in the meta section of that particular post, the same area a post’s publication/update date and author are displayed. Other blogs display this information at the bottom of each post.

    Tags are different, though. It’s not uncommon for blogs to have dozens upon dozens of tags or even hundreds. Therefore, you shouldn’t place them in your menu the way you would categories.

    One common way to display tags is to use the Tag Cloud widget in WordPress. This type of widget showcases your most-used tags (up to 75) in a list with buttons for each tag.

    How this collage appears on your site is dependent on your theme. However, you can style it on your own or create your own version if you’re familiar with HTML, CSS and a little PHP.

    WordPress categories vs tags in terms of SEO

    Categories and tags are more beneficial for user experience and less for SEO. They help search engine crawlers navigate your website and better understand which niche you’re trying to target. However, they’re not ranking factors all on their own.

    Furthermore, if you’re familiar with social media, it’s important not to confuse WordPress tags with hashtags. Cluttering your posts with numerous tags and naming tags after trending topics will not make it easier for searchers to find your content. This is because your blog does not have its own algorithm in the way social media platforms do.

    In reality, you should assign no more than three tags to each post and only create tags for topics you’ve created two or more posts for.

    Other Taxonomies in WordPress

    Some WordPress plugins add what are known as “custom post types” to your installation. You can even create them yourself. But before we get into that explanation, let’s first cover what post types are as a whole.

    Blog posts and pages are both technically web pages, but as you know, they’re quite different from one another. They have different layouts. Plus, pages are separate entities from one another while blog posts are a collection of pages linked to the “blog” section of your WordPress installation.

    To make this distinction, WordPress created the “post type” and packages two with every new WordPress installation: pages and blog posts, though attachments, like images, are considered post types as well.

    They essentially help the application and Google identify what types of pages you publish as it considers pages to be more important than blog posts. Each post type even comes with theme-dependent global styles and layout settings you can configure for each to make changing your site’s design much easier.

    So, what are custom post types? A custom post type (CPT) is any additional post type available in your installation not there by default.

    For instance, when you install the ecommerce plugin WooCommerce on your site, you get a new post type called “product” to help you create fully-fledged product pages by filling in details about each product.

    But how do taxonomies fit into all of this?

    Well, just like the “post” post type has categories and tags, some custom post types have taxonomies of their own.

    When you install WooCommerce, you’ll notice the product CPT has its own categories and tags. These allow you to organize the products you sell into primary product types the same way post categories allow you to organize blog posts into primary topics.

    Product tags are often used to group specific types of products together. For example, you could create tags for “white shoes,” “blue jeans” and “black jacket.”

    You could even create tags for different brands you sell on your store if you don’t want to purchase WooCommerce’s official Brands extension, which creates a custom taxonomy for brands that’s entirely separate from categories and tags.

    Less Common Taxonomies

    Like WooCommerce, other plugins create CPTs that come with their own taxonomies.

    One big example are learning management system (LMS) plugins. An LMS plugin creates a “course” CPT in your WordPress installation, allowing you to create courses on your site without having to use third-party solutions like Teachable or Udemy.

    LearnDash, for instance, comes with two taxonomies for course categories and course tags, allowing you to organize course topics accordingly.

    There are also knowledge base plugins, like Heroic Knowledge Base. The Heroic KB plugin by HeroThemes adds an “article” CPT to your site for knowledge base articles connected to the knowledge base system it creates for you.

    You can organize KB articles with the custom taxonomies the plugin comes with: article categories and article tags.

    If you install a forum plugin like bbPress, you’ll get CPTs for forums and topics. You can then group similar forums together with the plugin’s category taxonomy.

    Additional Taxonomies for Existing Post Types

    Do you create multiple pages that are like one another and wish you could group them in categories together in the same way you do blog posts? The aptly-named Create and Assign Categories for Pages plugin allows you to do just that.

    Lastly, if you want to organize media files into categories, you can use the Media Library Categories plugin to organize different images and other media into groups. For example, you could create an entire category for featured images.

    How to Create Custom Taxonomies in WordPress

    Creating custom taxonomies in WordPress is easy. You can use a third-party plugin or create your own manually.

    The easiest way to do this with a third-party plugin is to use a CPT plugin, such as Custom Post Type UI, WordPress Creation Kit, Pods, Toolset Types or Custom Post Type Maker. Some of these plugins even allow you to assign custom taxonomies to default post types.

    However, if the thought of adding another third-party plugin to your site does not interest you, you can always create a custom taxonomy manually using the following code:

    <?php
    /*
    * Plugin Name: Create a Genres Taxonomy
    * Description: Add a custom taxonomy called Genres to your site.
    * Version: 1.0
    * Author: Design Bombs
    * Author URI: https://designbombs.com/
    */ 
    function create_genres_taxonomy() {
         $labels = array(
             'name'              => _x( 'Genres', 'taxonomy general name' ),
             'singular_name'     => _x( 'Genre', 'taxonomy singular name' ),
             'search_items'      => __( 'Search Genres' ),
             'all_items'         => __( 'All Genres' ),
             'parent_item'       => __( 'Parent Genre' ),
             'parent_item_colon' => __( 'Parent Genre:' ),
             'edit_item'         => __( 'Edit Genre' ),
             'update_item'       => __( 'Update Genre' ),
             'add_new_item'      => __( 'Add New Genre' ),
             'new_item_name'     => __( 'New Genre Name' ),
             'menu_name'         => __( 'Genres' ),
         );
         $args   = array(
             'hierarchical'      => true,
             'labels'            => $labels,
             'show_ui'           => true,
             'show_admin_column' => true,
             'query_var'         => true,
             'show_in_rest'      => true,
             'rewrite'           => [ 'slug' => 'genre' ],
         );
         register_taxonomy( 'genres', [ 'post' ], $args );
    }
    add_action( 'init', 'create_genres_taxonomy' );
    ?>

    This code adds a “Genres” taxonomy to the default “post” post type. We’re going to create a lightweight plugin for it, but you can also add this code to your child theme’s functions.php file. Do not do this if you don’t use a child theme as the code will vanish when you update your theme.

    Copy the code from above into a text editor, such as Notepad on Windows, TextEdit on Mac (make sure you go to Format → Make Plain Text), Text on Chromebook, Notepad++, Sublime Text, Atom, etc. The latter four options are color coded, which will make it easier for you to edit the code within.

    Some of these text editors even have “find and replace” tools that will make this task even easier.

    All you need to do is decide what taxonomy you’d like to create, then replace every instance of “genre” with it.

    Let’s use “books” as an example:

    • Change “Genre” to “Book”
    • Change “genre” to “book”
    • Change “Genres” to “Books”
    • Change “genres” to “books”
    • Change “create_genres_taxonomy” to “create_books_taxonomy”

    Save the file as taxonomy-name.php, so “books.php”. If your taxonomy has more than one word, separate them with dashes.

    Create a folder, and name it after your taxonomy, so “books”. Then, move books.php into that folder, and zip it.

    From the backend of your WordPress site, go to Plugins → Add New → Upload Plugin. Click Choose File, then upload your ZIP folder to install and activate your custom plugin.

    You should now see your custom taxonomy listed under the Posts menu item and can also assign them on the Edit Post page.

    Final Thoughts

    WordPress taxonomies are an important yet underrated aspect of running a blog. They can help you pinpoint your niche by giving you a simple way to determine the primary topics your blog should and does cover.

    More importantly, they help you improve the user experience on the frontend of your site by allowing visitors to find posts about certain topics more efficiently.
    Whether you’re using WordPress’ default taxonomies, custom taxonomies added by a third-party plugin or your own, be sure to add them to your menus so readers and customers can find that content.

    lyn

    Lyn Wildwood is a freelance blogger and avid WordPress user. She loves sharing new tips and tricks with the WordPress community.

    Recent Posts

    How to Install Brushes in Photoshop

    One of the most powerful features of Photoshop is the ability to download and install…

    2 weeks ago

    How To Make A Website – Step by Step Beginner’s Guide

    So you want to make a website? That's awesome! But if you've never built a…

    2 weeks ago

    9 Best WordPress Hosting Options for 2022 – Compared

    Finding the best WordPress hosting can be a painful process. Finding a solution that will…

    3 weeks ago

    Apache vs Nginx Servers: The Lowdown On These Two Server Types

    The internet runs on a collection of servers. However, these have a different setup than…

    3 weeks ago

    Divi Theme Review 2022 – Still the Ultimate WordPress Theme!

    In this Divi review, I will show you what you can do with the Divi…

    3 weeks ago

    How to Start a Blog – The Definitive Guide for Beginners

    Thinking about starting a blog? Whether you want to blog for fun or blog for…

    3 weeks ago