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.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Professional WordPress: Design and Development | $6.04 | Buy on Amazon |
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.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →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
- Used Book in Good Condition
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.
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.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.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteAfter 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
Verify the complete workflow
- Confirm the taxonomy is registered on
initand attached to the intended object type. - Check that its labels, hierarchy, and admin controls match the editing workflow.
- If using the block editor or REST API, confirm
show_in_restis enabled and inspect the taxonomy routes. - Create terms and assign them to content of the associated type.
- Check the expected public URL and, if rewrite settings changed, flush rewrite rules once.
- 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.




