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

	$labels = array(
		'name'                       => _x( 'Tipos de proyecto', 'Taxonomy General Name', 'modern_talking' ),
		'singular_name'              => _x( 'Tipo de proyecto', 'Taxonomy Singular Name', 'modern_talking' ),
		'menu_name'                  => __( 'Tipo de proyecto', 'modern_talking' ),
		'all_items'                  => __( 'Todos los tipos', 'modern_talking' ),
		'parent_item'                => __( 'Item padre', 'modern_talking' ),
		'parent_item_colon'          => __( 'Item padre:', 'modern_talking' ),
		'new_item_name'              => __( 'Nombre del tipo de proyecto', 'modern_talking' ),
		'add_new_item'               => __( 'Añadir nuevo', 'modern_talking' ),
		'edit_item'                  => __( 'Editar', 'modern_talking' ),
		'update_item'                => __( 'Actualizar', 'modern_talking' ),
		'view_item'                  => __( 'Ver item', 'modern_talking' ),
		'separate_items_with_commas' => __( 'Separa con comas', 'modern_talking' ),
		'add_or_remove_items'        => __( 'Añadir o eliminar', 'modern_talking' ),
		'choose_from_most_used'      => __( 'Elige entre las más usadas', 'modern_talking' ),
		'popular_items'              => __( 'Items populares', 'modern_talking' ),
		'search_items'               => __( 'Buscar', 'modern_talking' ),
		'not_found'                  => __( 'Nada encontrado', 'modern_talking' ),
		'no_terms'                   => __( 'Sin items', 'modern_talking' ),
		'items_list'                 => __( 'Lista de items', 'modern_talking' ),
		'items_list_navigation'      => __( 'Items list navigation', 'modern_talking' ),
	);
	$rewrite = array(
		'slug'                       => 'project-type',
		'with_front'                 => true,
		'hierarchical'               => false,
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => false,
		'rewrite'                    => $rewrite,
	);
	register_taxonomy( 'mt_project_type', array( 'mt_projects' ), $args );

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