Taxonomy Generator

Overview

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

Usage

  • 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.

Examples

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 ECE_disco() {

	$labels = array(
		'name'                       => _x( 'Discos', 'Taxonomy General Name', 'ECE_domain_Disco' ),
		'singular_name'              => _x( 'Disco', 'Taxonomy Singular Name', 'ECE_domain_Disco' ),
		'menu_name'                  => __( 'Disco', 'ECE_domain_Disco' ),
		'all_items'                  => __( 'Todos discos', 'ECE_domain_Disco' ),
		'parent_item'                => __( 'Disco padre', 'ECE_domain_Disco' ),
		'parent_item_colon'          => __( 'Parent Item:', 'ECE_domain_Disco' ),
		'new_item_name'              => __( 'Nuevo disco', 'ECE_domain_Disco' ),
		'add_new_item'               => __( 'Agregar disco', 'ECE_domain_Disco' ),
		'edit_item'                  => __( 'Editar disco', 'ECE_domain_Disco' ),
		'update_item'                => __( 'Actualizar disco', 'ECE_domain_Disco' ),
		'view_item'                  => __( 'Ver disco', 'ECE_domain_Disco' ),
		'separate_items_with_commas' => __( 'Separate items with commas', 'ECE_domain_Disco' ),
		'add_or_remove_items'        => __( 'Add or remove items', 'ECE_domain_Disco' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'ECE_domain_Disco' ),
		'popular_items'              => __( 'Popular Items', 'ECE_domain_Disco' ),
		'search_items'               => __( 'Search Items', 'ECE_domain_Disco' ),
		'not_found'                  => __( 'Not Found', 'ECE_domain_Disco' ),
		'no_terms'                   => __( 'No items', 'ECE_domain_Disco' ),
		'items_list'                 => __( 'Items list', 'ECE_domain_Disco' ),
		'items_list_navigation'      => __( 'Items list navigation', 'ECE_domain_Disco' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => false,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'show_in_rest'               => true,
	);
	register_taxonomy( 'ECE_disco', array( 'ECE_canciones' ), $args );

}
add_action( 'init', 'ECE_disco', 0 );