October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Create Custom Taxonomies in WordPress

Register a custom WordPress taxonomy for the right content type, configure its editor and REST behavior, and make its terms useful in URLs, queries, and templates.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To create a custom taxonomy in WordPress, register it with register_taxonomy() on the init hook, attach it to the content type it classifies, and configure its term-management interface, REST access, and URL rules. Then add terms, assign them to content, and display them in your theme or queries.

Decide what the taxonomy should classify

A taxonomy groups content through terms. In WordPress, terms may stand alone or sit in parent-and-child relationships. Choose the structure according to how readers and editors need to organize content—not according to whether the labels sound like categories or tags.

As an Amazon Associate I earn from qualifying purchases.

Choice Term relationships Editing experience URL consideration
Hierarchical Terms can have parent and child terms. Category-style selection. Hierarchical rewrite paths may suit nested information architecture.
Flat Terms are independent; there are no parent-and-child relationships. Tag-style assignment. Use a flat URL structure unless the site’s URL design calls for otherwise.

For example, a book site might use a hierarchical genre taxonomy, while an article site might use a flat topic taxonomy. A taxonomy can apply to one or more object types, such as a custom post type, so decide which content should receive these terms before registering it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Register the taxonomy on init

WordPress’s register_taxonomy() function reference says, “Do not use before the ‘init’ hook.” Its signature is register_taxonomy( string $taxonomy, array|string $object_type, array|string $args = array() ). The first argument is the taxonomy key; the second names the object type or types it applies to; the third configures its behavior.

#1 Best Overall
add_action( 'init', 'freedom251_register_genre_taxonomy' );

function freedom251_register_genre_taxonomy() {
    register_taxonomy(
        'genre',
        array( 'book' ),
        array(
            'labels' => array(
                'name'          => 'Genres',
                'singular_name' => 'Genre',
            ),
            'hierarchical'      => true,
            'show_ui'           => true,
            'show_admin_column' => true,
            'query_var'         => true,
            'rewrite'           => array( 'slug' => 'genre' ),
        )
    );
}

In this example, book is the registered content type to classify. Replace it with your actual post type key. If you are registering that custom post type yourself, register both on init; ensure the post type is registered before the taxonomy is attached to it.

Choose a safe taxonomy key

The key is part of WordPress’s technical interface, not just the label shown to editors. The current function reference limits it to 32 characters and allows lowercase letters, numbers, dashes, and underscores. Pick a short, descriptive key and avoid collisions with existing taxonomies, post types, and reserved public or private query variables.

Configure only the behavior you need

Common arguments include labels, description, public, show_ui, hierarchical, show_admin_column, query_var, rewrite, capabilities, and show_in_rest. Defaults can be inherited: for example, show_ui and related settings may inherit from public. Set important behavior explicitly when you need predictable editor or front-end access. See the function reference for the full argument list and defaults.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make terms manageable in the admin and editor

Labels make the taxonomy understandable in the dashboard; show_ui controls whether WordPress provides its term-management interface, and show_admin_column adds a column for it to the associated content list. These are separate choices from REST exposure.

Set 'show_in_rest' => true when the taxonomy needs to be available in the block editor or through the REST API. It is not automatic for a custom taxonomy. You can optionally set rest_base to choose the REST route base. WordPress uses WP_REST_Terms_Controller as the default REST controller. The REST API handbook documents taxonomy discovery at /wp/v2/taxonomies and an individual taxonomy at /wp/v2/taxonomies/<taxonomy>; the response schema includes the slug, whether it is hierarchical, associated types, and REST route information.

Once registered, create terms using the taxonomy’s admin screen, then assign them to content. Registration creates the classification system; it does not populate terms or automatically guarantee that assigned terms will appear on the front end.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Set public URLs and display taxonomy content

The rewrite argument controls URL rewriting. In the example, 'slug' => 'genre' supplies the public path base. For a hierarchical taxonomy, 'hierarchical' => true also determines whether its rewrite URLs can reflect the term hierarchy. Choose these settings to fit your information architecture rather than assuming that admin labels dictate URL structure.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After changing rewrite settings, WordPress may need its rewrite rules flushed. The function reference advises doing this once after taxonomy creation or a rewrite change—not on every page load or every plugin/theme load. In a plugin, perform the flush during an activation or other one-time setup process, rather than in the registration callback.

For public display, create or adapt taxonomy archive templates in your theme. WordPress’s Theme Handbook template hierarchy explains how templates are selected for taxonomy archives. You can also retrieve terms and use them in your own queries or output; the Plugin Handbook’s taxonomy guide covers registration, retrieval, and rendering. Choose a template or query approach that fits the way visitors should browse the classified content.

Quick Recap

Bestseller No. 1
Professional WordPress: Design and Development
Professional WordPress: Design and Development
Used Book in Good Condition
$6.04

Verify the complete workflow

  1. Confirm the taxonomy is registered on init and attached to the intended object type.
  2. Check that its labels, hierarchy, and admin controls match the editing workflow.
  3. If using the block editor or REST API, confirm show_in_rest is enabled and inspect the taxonomy routes.
  4. Create terms and assign them to content of the associated type.
  5. Check the expected public URL and, if rewrite settings changed, flush rewrite rules once.
  6. Verify that the theme template, query, or other front-end output actually displays the terms or matching content.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.