Taxonomy Generator


Use this tool to create custom code for Taxonomies with register_taxonomy() function.


  • Fill in the user-friendly form.
  • Click the “Update Code” button.
  • Copy the code to your project.
  • Or save it as a snippet and share with the community.


If you are still learning how to use this tool, check out the following examples:

The function used in the code.
Add Child Themes Support.
Translation file Text Domain. Optional.
Key used in the code. Up to 32 characters, lowercase.
Taxonomy singular name.
Taxonomy plural name.
Comma separated list of Post Types.
Hierarchical taxonomy allows descendants.
Show this taxonomy in the admin UI.
Show taxonomy managing UI in the admin.
Show taxonomy columns on associated post-types.
Show in tag cloud widget.
Taxonomy available for selection in Navigation Menus.
Direct query variable used in WP_Query. e.g. WP_Query( array( 'taxonomy' => 'genre', 'term' => 'comedy' ) )
Custom query variable.
Set custom user capabilities to manage taxonomy. Default: category capabilities
Whether to include the taxonomy in the REST API.
To change the base url of REST API route. Default is the taxonomy key.
REST API Controller class name. Default is 'WP_REST_Terms_Controller'.
A function name that will be called when the count of an associated Post Type is updated.
  Save Snippet
// Register Custom Taxonomy
function bodhi_hcpt_sample_pack_category() {

	$labels = array(
		'name'                       => _x( 'Sample Pack Categories', 'Taxonomy General Name', 'hardcore_cpt' ),
		'singular_name'              => _x( 'Sample Pack Category', 'Taxonomy Singular Name', 'hardcore_cpt' ),
		'menu_name'                  => __( 'Sample Pack Categories', 'hardcore_cpt' ),
		'all_items'                  => __( 'All Sample Pack Categories', 'hardcore_cpt' ),
		'parent_item'                => __( 'Parent Category', 'hardcore_cpt' ),
		'parent_item_colon'          => __( 'Parent Category:', 'hardcore_cpt' ),
		'new_item_name'              => __( 'New Sample Pack Category', 'hardcore_cpt' ),
		'add_new_item'               => __( 'Add New Sample Pack Category', 'hardcore_cpt' ),
		'edit_item'                  => __( 'Edit Sample Pack Category', 'hardcore_cpt' ),
		'update_item'                => __( 'Update Sample Pack Category', 'hardcore_cpt' ),
		'view_item'                  => __( 'View Sample Pack Category', 'hardcore_cpt' ),
		'separate_items_with_commas' => __( 'Separate categories with commas', 'hardcore_cpt' ),
		'add_or_remove_items'        => __( 'Add or Remove Sample Pack Categories', 'hardcore_cpt' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'hardcore_cpt' ),
		'popular_items'              => __( 'Popular Sample Pack Categories', 'hardcore_cpt' ),
		'search_items'               => __( 'Search Sample Pack Categories', 'hardcore_cpt' ),
		'not_found'                  => __( 'Not Found', 'hardcore_cpt' ),
		'no_terms'                   => __( 'No Sample Pack Categories', 'hardcore_cpt' ),
		'items_list'                 => __( 'Sample Pack Categories list', 'hardcore_cpt' ),
		'items_list_navigation'      => __( 'Sample Pack Categories list navigation', 'hardcore_cpt' ),
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'show_in_rest'               => true,
	register_taxonomy( 'sample_pack_category', array( 'sample-packs' ), $args );

add_action( 'init', 'bodhi_hcpt_sample_pack_category', 0 );