A taxonomy in WordPress is a classification system used to group and organize content. Every taxonomy contains terms — the individual labels used to categorize posts, pages, or custom post types. WordPress ships with two built-in taxonomies: categories and tags. But developers can register custom taxonomies to create any classification structure a site needs — genres, locations, product types, service areas, or anything else.

Understanding taxonomies matters for anyone managing a content-heavy WordPress site, even if you never write a line of code. The way taxonomies are structured determines how visitors browse your content, how search engines understand your site’s topics, and how efficiently editors can organize and find posts. For developers, custom taxonomies are one of the most powerful tools for building structured, flexible WordPress sites.

How Taxonomies Work in WordPress

WordPress stores taxonomy data in dedicated database tables (wp_terms, wp_term_taxonomy, and wp_term_relationships). When a post is tagged with a term from a taxonomy, WordPress creates a relationship between that post and that term in the database.

Every taxonomy has two key properties:

  • Hierarchical — Behaves like categories. Terms can have parent-child relationships (e.g., “North America” containing “United States” and “Canada”). Displayed as checkboxes in the post editor.
  • Non-hierarchical — Behaves like tags. Terms are flat with no parent-child relationships. Displayed as a text input field in the post editor.

Taxonomies are registered using the register_taxonomy() function and are attached to one or more post types. Once registered, WordPress automatically:
– Creates taxonomy term archive pages with their own URLs
– Adds a taxonomy meta box to the post editor
– Enables the taxonomy in REST API endpoints
– Creates admin screens for managing terms

For business owners, the key thing to know is that taxonomies create the organizational structure behind your content — they’re the reason you can browse all your blog posts on “kitchen remodeling” or filter portfolio items by “brand identity” projects.

Purpose & Benefits

1. Flexible Content Organization Beyond Categories and Tags

Built-in categories and tags work for simple blog sites, but custom taxonomies let you build classification systems tailored to your content. A real estate site can have a “Property Type” taxonomy (single-family, condo, commercial). A law firm can have a “Practice Area” taxonomy. A recipe site can have “Dietary Restrictions” and “Cuisine” taxonomies. Each creates its own browseable archive and filter options. This is a core capability in custom post type development.

2. Improved Site Navigation and Content Discovery

Each taxonomy term gets its own archive page — a URL like /genre/fiction/ that lists all posts with that term. These archive pages give visitors browseable paths through your content and give search engines additional URLs that signal topical depth. Well-structured taxonomy archives can rank in search results for category-level queries and drive meaningful organic traffic. Our WordPress development services include taxonomy architecture planning.

3. Enables Dynamic Filtering and Query Logic

Custom taxonomies integrate with WP_Query to enable filtered content displays. A portfolio page can show only “Branding” projects. A recipe archive can filter by “Vegan” and “Gluten-Free” simultaneously. Event listings can filter by location and category. Taxonomies are what make these dynamic, user-controlled filtering interfaces possible without requiring a plugin for every use case.

Examples

1. Registering a Custom Taxonomy for a Portfolio

A WordPress developer registers a custom taxonomy called “Project Type” for a portfolio custom post type:

// Register a hierarchical 'project_type' taxonomy for the 'portfolio' post type
add_action( 'init', 'cyberoptik_register_project_taxonomy' );

function cyberoptik_register_project_taxonomy() {
    $labels = array(
        'name'          => 'Project Types',
        'singular_name' => 'Project Type',
        'search_items'  => 'Search Project Types',
        'all_items'     => 'All Project Types',
        'edit_item'     => 'Edit Project Type',
        'add_new_item'  => 'Add New Project Type',
        'menu_name'     => 'Project Types',
    );

    register_taxonomy( 'project_type', 'portfolio', array(
        'hierarchical' => true,   // Behaves like categories
        'labels'       => $labels,
        'show_ui'      => true,
        'show_in_rest' => true,   // Enables Gutenberg support
        'rewrite'      => array( 'slug' => 'project-type' ),
    ) );
}

Once registered, editors can assign project types to portfolio items from the post editor, and the site automatically generates archive pages like /project-type/branding/ listing all branding projects.

2. Flat Taxonomy for Recipe Dietary Labels

A recipe site needs a non-hierarchical “Diet” taxonomy that works like tags:

// Register a flat 'diet' taxonomy for the 'recipe' custom post type
add_action( 'init', 'cyberoptik_register_diet_taxonomy' );

function cyberoptik_register_diet_taxonomy() {
    register_taxonomy( 'diet', 'recipe', array(
        'hierarchical'      => false,  // Flat, like tags
        'label'             => 'Dietary Labels',
        'show_in_rest'      => true,
        'show_admin_column' => true,   // Shows diet column in post list
        'rewrite'           => array( 'slug' => 'diet' ),
    ) );
}

Recipes can now be tagged “Vegan,” “Keto,” or “Nut-Free” — and visitors can browse /diet/vegan/ to see all vegan recipes.

3. Using a Taxonomy in WP_Query for Filtered Archives

Once a taxonomy is registered, it can filter content in WP_Query:

// Fetch portfolio items in the 'branding' project type
$args = array(
    'post_type'  => 'portfolio',
    'tax_query'  => array(
        array(
            'taxonomy' => 'project_type',
            'field'    => 'slug',
            'terms'    => 'branding',
        ),
    ),
);
$portfolio_query = new WP_Query( $args );

This retrieves only portfolio items tagged with the “branding” project type — useful for filtered portfolio pages, related content sections, or dynamic archive templates.

Common Mistakes to Avoid

  • Registering taxonomies after the init hook — Taxonomy registration must happen on the init action. Registering too late means WordPress won’t set up the rewrite rules, REST API endpoints, or admin screens correctly.
  • Using register_taxonomy() in a plugin but not the theme — Taxonomy registrations should live in a site-specific plugin rather than a theme’s functions.php. If the theme is changed, taxonomies registered in the theme disappear — along with all the term assignments on your content.
  • Not flushing rewrite rules after registration — After adding a new taxonomy, visit Settings > Permalinks in the WordPress admin and save (without changing anything). This flushes the rewrite rules and makes taxonomy archive URLs work properly.
  • Confusing taxonomies with custom fields — Taxonomies are for grouping and filtering content into categories. Custom fields store specific values (like a price, date, or address) attached to a single post. Both have their place, but they serve different purposes and shouldn’t be substituted for each other.

Best Practices

1. Register Taxonomies in a Must-Use Plugin or Site Plugin

Taxonomy registrations belong in a plugin, not a theme. This ensures the taxonomy structure persists if the theme changes and keeps content architecture separate from design. A simple site-specific plugin with just the taxonomy registration is the cleanest approach for custom sites.

2. Enable show_in_rest for Block Editor Compatibility

Setting 'show_in_rest' => true in your taxonomy registration exposes the taxonomy through the REST API and enables it in the block editor (Gutenberg). Without this, the taxonomy meta box won’t appear in the Gutenberg editor — only the classic editor. This is an easy setting to miss and can cause frustration for content editors.

3. Plan Taxonomy Structure Before Launch

Changing a taxonomy’s slug or hierarchy after content has been published causes broken URLs and orphaned content. Plan your taxonomy structure carefully before launch — decide which taxonomies need to be hierarchical, what their archive URL slugs should be, and what terms they’ll contain. Changing this architecture post-launch requires a migration process that includes redirect management.

Frequently Asked Questions

What is the difference between a taxonomy and a custom field?

A taxonomy groups posts into named categories that can have their own archive pages and are used for filtering and navigation. A custom field stores a specific value (like a price, date, or phone number) on an individual post. Use taxonomies for things that apply to multiple posts and need archives or filtering. Use custom fields for unique data points on individual posts.

Do I need a developer to create a custom taxonomy?

For most custom taxonomies, yes — they require PHP code in a plugin. Plugins like ACF (Advanced Custom Fields) or Pods offer UI-based taxonomy creation without writing code, which may be sufficient for simpler needs. For taxonomies with complex rewrite rules, custom capabilities, or integration with other site systems, developer involvement is recommended.

Can taxonomies be used with any post type?

Yes. The register_taxonomy() function accepts any registered post type as the $object_type parameter. A taxonomy can even be attached to multiple post types simultaneously — for example, a “Location” taxonomy that works for both Events and Jobs post types.

Do taxonomy archive pages get indexed by search engines?

By default, yes — taxonomy archive pages are public and indexable. For taxonomies with few terms or thin archives, you may want to configure noindex on specific archives. For well-populated archives, these pages can rank in search results for category-level queries and drive meaningful traffic.

Related Glossary Terms

How CyberOptik Can Help

Taxonomy architecture is one of those foundational decisions that shapes how a WordPress site performs for years after launch. Whether you need a single custom taxonomy for a portfolio, a complex multi-taxonomy content system for a directory or membership site, or a review of an existing structure that isn’t working well, our development team can design and build it. You don’t need to write this code yourself — that’s what we’re here for. Get in touch to discuss your project or explore our WordPress development services.