Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11To add categories to a WordPress custom post type, either associate the built-in category taxonomy with that post type or register a separate hierarchical taxonomy. Register the taxonomy and post type on init. For the block editor, enable REST exposure with show_in_rest => true on both the taxonomy and the post type.
Choose the right category model
| Approach | Terms | Best when |
|---|---|---|
Built-in category |
Shares the site’s existing category terms | Your custom posts should use the same category tree as regular posts |
| Custom hierarchical taxonomy | Has its own terms, labels and optional rewrite settings | Your custom post type needs an independent category structure |
In WordPress, categories are taxonomies. Adding 'category' to a post type associates the existing taxonomy; it does not create a new one. A custom taxonomy must be registered explicitly with register_taxonomy().
Option 1: share WordPress’s existing categories
If the custom post type is already registered in your code, add category to its taxonomies argument:
register_post_type(
'book',
array(
'label' => __( 'Books', 'textdomain' ),
'public' => true,
'show_in_rest' => true,
'taxonomies' => array( 'category' ),
)
);
Replace book with the actual post type key. The post type must be registered on init, and show_in_rest should be enabled when the block editor is required.
#1 Best Overall
Option 2: create a separate category taxonomy
Use a hierarchical custom taxonomy when the post type needs its own parent-and-child category tree:
add_action( 'init', 'my_register_book_taxonomy' );
function my_register_book_taxonomy() {
register_taxonomy(
'book_category',
array( 'book' ),
array(
'label' => __( 'Categories', 'textdomain' ),
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
)
);
}
Here, book_category is the taxonomy key and book is the registered custom post type key. Set hierarchical to true for category-like parent/child terms. A non-hierarchical taxonomy behaves more like tags.
Rank #2
show_ui displays taxonomy controls in the admin area, show_admin_column adds a taxonomy column to the post type’s list table, and show_in_rest exposes the taxonomy to the block editor and REST API. WordPress introduced taxonomy show_in_rest support in version 4.7.0.
Declare the association on the post type too
WordPress recommends declaring associated taxonomies in the post type registration for consistency, while still explicitly registering a custom taxonomy:
Rank #3
register_post_type(
'book',
array(
'label' => __( 'Books', 'textdomain' ),
'public' => true,
'show_in_rest' => true,
'taxonomies' => array( 'book_category' ),
)
);
Register both components on init. The taxonomy’s object type array must contain the exact post type key. WordPress’s taxonomy reference warns: “Do not use before the ‘init’ hook.”
Why categories do not appear in the block editor
- Confirm that the post type registration includes
'show_in_rest' => true. - Confirm that the taxonomy registration includes
'show_in_rest' => true. - Check that the taxonomy is attached to the correct post type key, including spelling and underscores.
- Verify that registration runs on
init, not before it.
REST exposure is required for the taxonomy control to be available in the block editor. A taxonomy can still appear in another administration context while remaining unavailable in the block editor if either REST setting is missing.
Rank #4
When another plugin or theme owns the post type
First identify the existing post type key and inspect its registration before adding code. If you do not control the registration, WordPress provides the register_post_type_args and register_taxonomy_args filters for adjusting arguments such as REST exposure. Avoid registering a duplicate post type or taxonomy.
Quick Recap
Best Value
Common fixes
- No taxonomy controls: enable
show_uiand confirm the taxonomy is associated with the correct post type. - No taxonomy column in the list screen: enable
show_admin_column. - Terms are shared unexpectedly: use a custom taxonomy instead of the built-in
categorytaxonomy. - Categories disappear after a theme change: move registration into a plugin. Theme-based registration is lost when that theme is deactivated.
- Terms cannot be assigned: check that the taxonomy is registered for the same post type key used by the post type.
Practical decision checklist
- Use
categoryif these posts should reuse the site’s existing category terms. - Use a custom taxonomy if the posts need separate terms or labels.
- Set
hierarchicaltotruefor parent/child categories. - Set
show_in_resttotrueon both the taxonomy and post type for the block editor. - Register on
initand keep persistent content structures in a plugin.
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.
Recommended Free Tools

