Taxonomy Generator

Use this tool to create custom code for Taxonomies with register_taxonomy() function. Fill out the form, update the code, copy the code to your theme/plugin.

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. e.g. Genre or Person. Taxonomy plural name. e.g. Genres or People.
Link to Post Type. e.g. post, page, attachment or any other. 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.
Use Default Permalinks (using taxonomy key), prevent automatic URL rewriting (no pretty permalinks), or set custom permalinks.
Pretty permalink base text. i.e. www.example.com/ganer/
Use taxonomy slug as URL base.
Default: Yes
Allow hierarchical URLs.
Default: No
Set custom user capabilities to manage taxonomy. Default: category capabilities
A function name that will be called when the count of an associated Post Type, such as post, is updated.

// Register Custom Taxonomy
function custom_taxonomy()  {
	$labels = array(
		'name'                       => _x( 'Genres', 'Taxonomy General Name', 'text_domain' ),
		'singular_name'              => _x( 'Genre', 'Taxonomy Singular Name', 'text_domain' ),
		'menu_name'                  => __( 'Genre', 'text_domain' ),
		'all_items'                  => __( 'All Genres', 'text_domain' ),
		'parent_item'                => __( 'Parent Genre', 'text_domain' ),
		'parent_item_colon'          => __( 'Parent Genre:', 'text_domain' ),
		'new_item_name'              => __( 'New Genre Name', 'text_domain' ),
		'add_new_item'               => __( 'Add New Genre', 'text_domain' ),
		'edit_item'                  => __( 'Edit Genre', 'text_domain' ),
		'update_item'                => __( 'Update Genre', 'text_domain' ),
		'separate_items_with_commas' => __( 'Separate genres with commas', 'text_domain' ),
		'search_items'               => __( 'Search genres', 'text_domain' ),
		'add_or_remove_items'        => __( 'Add or remove genres', 'text_domain' ),
		'choose_from_most_used'      => __( 'Choose from the most used genres', 'text_domain' ),
	);

	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	);

	register_taxonomy( 'genre', 'post', $args );
}

// Hook into the 'init' action
add_action( 'init', 'custom_taxonomy', 0 );