WordPress

A Guide to WordPress Taxonomies

An assortment of spray paint cans.

Learning how to effectively use Categories, Tags, and Custom Taxonomies 

Most people who use WordPress are familiar with categories and tags. You write an article, toss it in a category or two, and throw some tags on it. This usage is only scratching the surface of the power of WordPress taxonomies. 

Fully understanding how taxonomies function will help you plan and build better websites using WordPress.

What is a taxonomy in WordPress?

A taxonomy is an arbitrary grouping of words used to classify and group website content together based on a relationship between the post and the taxonomy term. Put more simply, a taxonomy is a way to group things together and classify them.

“Tags” and “Categories” are the two default WordPress taxonomies, but WordPress allows for any number of custom taxonomies to be created and assigned to post types. Custom taxonomies have been available since WordPress 2.3 and are a powerful way to group and classify content. 

What is a taxonomy term?

A term is an individual tag or category within a taxonomy. Imagine you have a custom taxonomy for a doctor’s specialty. A term would be one specific category within your taxonomy, such as “Pediatrics.” 

By default, WordPress creates a term archive view. For our pediatrics example, the term archive would display all doctors who have been categorized as pediatricians.  

A custom post-type archive filtered to show posts categorized in ‘Pediatrics’

Term archive views are limited to a title and description element by default. You can add custom fields and WYSIWYG editors to a term page with Advanced Custom Fields. However, there is currently no way to use Gutenberg blocks for these pages. We’re hoping WordPress adds this functionality soon. 🤞🤞

Defining other common elements of WordPress 

Let’s dig into other parts of WordPress to get a better understanding of how they relate to taxonomies.

Page

A page is a single post with its own unique post ID. Each page has a unique URL. By default, pages do not have any built-in taxonomy. 

Post

A post is usually a blog post or article, and in some cases a post could be a product, a testimonial, an FAQ, a doctor, or any other custom post type (see below). By default, Posts can have categories and tags assigned to them. The user needs to define what those categories and tags are. 

Categories

Just what you think they are, a user-defined grouping for each piece of “post” content. Categories are hierarchical, meaning you can assign subcategories. An item assigned to a subcategory will be in both the parent and child categories. 

Each category term has their own archive view, which is a URL that displays each post assigned to that category.

Fun fact, this post is categorized under “WordPress”, which is actually a subcategory of “Web Development.” This means the post will appear in both “Web Development” and “WordPress” archives.

Tags

Tags function the same way as categories. They differ from categories in that tags are not hierarchical. Tags can be used in two ways, to signify more specific topics within an article, or to identify common traits that span multiple categories. 

Example of how to use Tags

Imagine a sports website. The categories for their posts are sports leagues—NHL, NFL, MLB. One way to use tags could be for sport cities. 

Articles about the Bulls would be in the NBA category with a “Chicago” tag, while articles about the Bears would share the “Chicago” tag, but be in the NFL category. This gives our fictional sports website a method to display information two separate ways: from an individual sport, and from a geographical perspective. It also creates a method to have a Chicago sports landing page (the “Chicago” term archive), benefitting both users and SEO.

Custom Post Types

WordPress only has “Pages” and “Posts” by default. However, you may have a type of content with information that needs its own organizational structure and taxonomy. You can create a custom post type (CPT) and define custom taxonomies. 

For example, imagine a doctor directory where each doctor is a single custom post and has a hierarchical taxonomy (category) representing their specialty and non-hierarchical taxonomy (tag) to represent each clinic or location they practice in. Each doctor would be represented by a single post, and the archive view would show all doctors, creating your directory. Then, the directory archive could be filtered based on the categories and tags you assigned.

WordPress Taxonomies help build better websites.

Unlock the dynamism inherent with WordPress by using custom post types and taxonomies to create a more structured and engaging website. With custom taxonomies, you can display the content you want where you want it. A taxonomy helps you build better, more nuanced information architecture, and gives users a method to filter content.

Posted in WordPress