WordPress Development

Designing Custom Taxonomies in WordPress That Stay Useful as the Site Grows

Designing Custom Taxonomies in WordPress That Stay Useful as the Site Grows

When a WordPress site grows beyond a simple blog, the built-in categories and tags start to strain. A recipe site needs cuisine, diet, course and difficulty. A job board needs location, contract type and department. A case study library needs industry, service and region. Cramming all of that into categories produces a mess: categories like “Vegetarian Italian Main Courses” and dozens of overlapping tags that nobody uses consistently. Custom taxonomies are the solution.

Custom taxonomies are the solution. They let you create new ways to group content, each with its own terms, archives, admin interface and query support. Well-designed custom taxonomies make filtering fast, navigation clear and content management straightforward. Poorly designed ones create confusion and are painful to change later. This article covers the design decisions that matter before you write any code.

What a taxonomy is

A taxonomy is a way of grouping things. WordPress has two built-in taxonomies for posts: categories, which are hierarchical, and tags, which are flat. WooCommerce adds product categories, product tags and attributes, which are also taxonomies.

A custom taxonomy works the same way. You register it, attach it to one or more post types and add terms, the individual values such as “Healthcare” or “Finance” for an industry taxonomy. WordPress stores the relationships in dedicated, indexed tables, which is why taxonomy queries are efficient.

Taxonomy or custom field?

This is the first and most important decision. Both can store information about a post, but they serve different purposes.

Use a taxonomy when:

  • You want to group and filter content by the value
  • Many posts share the same values
  • You want archive pages listing all posts with a value
  • The set of possible values is limited and reusable

Use a custom field when:

  • The value is unique or nearly unique per post, such as a price, date, phone number or URL
  • You need to store numbers or dates for comparison and sorting
  • You won’t list posts grouped by the value

For example, a property’s number of bedrooms could be either, but because people filter by it and the set of values is small, a taxonomy works well. A property’s exact price is better as a custom field, with price range filtering handled separately.

Choosing a taxonomy when filtering matters avoids the slow meta queries that plague sites where everything is stored as custom fields.

Hierarchical or flat?

Hierarchical taxonomies work like categories, with parent and child terms. Flat taxonomies work like tags.

Choose hierarchical when values naturally nest: regions within countries, subcategories of services, departments within divisions. Choose flat when values are independent: skills, features, ingredients.

The admin interface differs too. Hierarchical taxonomies show a checkbox list. Flat ones show a tag-style input where editors type terms. For a taxonomy with a fixed list of values that editors should choose from, not invent, a hierarchical interface with checkboxes is often better even if there’s no nesting, because it discourages creating duplicate terms through typing.

Naming

Names matter more than they seem, because they appear in code, URLs and the admin.

  • Taxonomy key: a short, lowercase identifier with a prefix to avoid collisions, such as acme_industry. Keep it under 32 characters.
  • Labels: clear plural and singular names for the admin, such as “Industries” and “Industry”.
  • Rewrite slug: the URL segment, such as industry, giving URLs like /industry/healthcare/.

Avoid reserved names. WordPress reserves certain terms used in queries, such as “type”, “year”, “author”, “name” and others. Using them as taxonomy keys causes strange bugs, like archive pages returning 404 errors. Check the list of reserved terms in the WordPress documentation before choosing.

Registering a taxonomy

A typical registration, in a plugin rather than a theme so the data structure survives theme changes:

Important arguments:

  • show_in_rest: required for the taxonomy panel to appear in the block editor, and for REST API access.
  • show_admin_column: adds a column to the post list, useful for editors.
  • public: controls whether archives and front-end queries are available. Set publicly_queryable to false for internal-only taxonomies.
  • rewrite: controls URLs. Set with_front to false to avoid inheriting a blog prefix.

After registering or changing rewrite settings, flush permalinks by visiting Settings, Permalinks.

Plan the terms, not just the taxonomy

A taxonomy is only as good as its terms. Before launch:

  • Define the initial list of terms.
  • Write descriptions for important terms, which can appear on archive pages.
  • Decide who can create new terms. By default, editors can. For controlled vocabularies, consider restricting term creation to administrators through capabilities.
  • Decide how terms will be named and capitalised, and stick to it.

Uncontrolled term creation is how taxonomies decay. One editor adds “Health care”, another “Healthcare”, another “Health”, and filters show three options for the same thing.

Archives and SEO

Public taxonomies get archive pages automatically. Each term’s archive lists its posts. These pages can be valuable for SEO and navigation, if they’re useful:

  • Add a unique introduction to important term archives, using the term description.
  • Use a dedicated template, such as taxonomy-acme_industry.php or a block theme template, to present terms well.
  • Avoid creating many terms with only one or two posts, which produce thin archive pages.

If a taxonomy exists only for internal organisation or filtering, consider making its archives non-public, or set them to noindex in your SEO plugin.

Querying taxonomies

Taxonomy queries are efficient and flexible:

In block themes, the Query Loop block can filter by custom taxonomies without code, which makes taxonomies even more useful for editors building pages.

Avoiding taxonomy sprawl

It’s easy to create a new taxonomy for every attribute. Too many taxonomies clutter the editor sidebar, confuse editors and make the content model hard to understand.

Before adding a taxonomy, ask:

  • Will editors use it consistently?
  • Will visitors filter or browse by it?
  • Could an existing taxonomy cover it?

A site with four well-maintained taxonomies is far more useful than one with twelve half-used ones.

Changing taxonomies later

Taxonomies are harder to change once content depends on them. Renaming a term is easy. Renaming a taxonomy key, merging taxonomies or converting tags into a custom taxonomy requires migration: reassigning terms with a script, updating templates and queries and redirecting old archive URLs.

That’s why the planning stage matters. Time spent designing custom taxonomies upfront saves far more time later.

A worked example: a recipe site

A food blogger came to me with over 900 recipes organised in a single category tree that had grown to more than 120 categories. “Vegan Desserts”, “Quick Vegan Dinners”, “Indian Vegetarian Mains” and dozens of similar combinations made navigation confusing and many category pages thin.

We replaced the tangled tree with four custom taxonomies: cuisine, course, diet and cooking time. Each recipe received one or more terms in each. Categories were reduced to a handful of broad sections used in the main menu. A migration script mapped every old category to the appropriate combination of new terms, and redirects sent old category URLs to the closest new archive or a filtered listing.

The result was a recipe archive where visitors could combine filters freely, such as Indian, main course, vegan, under 30 minutes, without anyone creating a category for each combination. Editors found tagging new recipes faster, because each taxonomy asked one clear question. Search traffic to the most important archive pages improved over the following months, because those pages now had more content and clear purpose instead of competing near-duplicates.

Documenting the content model

Write down each taxonomy’s purpose, who maintains its terms and how editors should use it. A short internal page with examples, such as “Diet: choose every diet this recipe suits; don’t create new terms without asking”, keeps the structure consistent as the team changes. Custom taxonomies are part of your site’s information architecture, and like any architecture, they last longer when the plans are written down.

Term order and display

By default, terms are listed alphabetically. For taxonomies with a natural order, such as skill levels or cooking times, alphabetical order looks odd. Use a term meta field for sort order, or a plugin that adds drag-and-drop term ordering, and respect that order in filters and templates.

Frequently asked questions

Should I register taxonomies in my theme?

Generally no. Register them in a plugin or must-use plugin, so the content structure remains if the theme changes.

Can a taxonomy apply to multiple post types?

Yes. Pass an array of post types when registering. Be aware that archives will then mix those post types unless you filter them.

How do I show a taxonomy in the block editor?

Set show_in_rest to true. Without it, the taxonomy panel won’t appear in the block editor.

Can terms have custom fields?

Yes. Term meta lets you store extra data on terms, such as icons, colours or images, and plugins like ACF provide interfaces for it.