Glossary Custom Taxonomies

WPTurbo » Snippets » Glossary Custom Taxonomies
0

Created with:

Taxonomy generator

Visibility: 

public

Creator: Jason

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Registers the 'glossary_category' taxonomy.
 * 
 * @return void
 */
function kd_register_glossary_taxonomy() : void {
	$labels = [
		'name' => _x( 'Categorys', 'Taxonomy Name', 'kd' ),
		'singular_name' => _x( 'Category', 'Taxonomy Singular Name', 'kd' ),
		'menu_name' => __( 'Categorys ', 'kd' ),
		'all_items' => __( 'All Categorys ', 'kd' ),
		'parent_item' => __( 'Parent Category ', 'kd' ),
		'parent_item_colon' => __( 'Parent Category: ', 'kd' ),
		'new_item_name' => __( 'New Category ', 'kd' ),
		'add_new_item' => __( 'Add New Category ', 'kd' ),
		'edit_item' => __( 'Edit Category ', 'kd' ),
		'update_item' => __( 'Update Category ', 'kd' ),
		'view_item' => __( 'View Category ', 'kd' ),
		'add_or_remove_items' => __( 'Add or Remove Categorys ', 'kd' ),
		'choose_from_most_used' => __( 'Choose from most used Categorys ', 'kd' ),
		'popular_items' => __( 'Popular Categorys ', 'kd' ),
		'search_items' => __( 'Search Categorys ', 'kd' ),
		'not_found' => __( 'Not Found ', 'kd' ),
		'no_terms' => __( 'No Categorys ', 'kd' ),
		'items_list' => __( 'Categorys List ', 'kd' ),
		'items_list_navigation' => __( 'Categorys List Navigation ', 'kd' ),
	];

	$args = [
		'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,
		'rest_base' => 'glossary_category',
		'rest_controller_class' => 'WP_REST_glossary_category_Terms_Controller',
		'update_count_callback' => 'wp_update_term_count',
	];

	register_taxonomy( 'glossary_category', ['glossary'], $args );
}
add_action( 'init', 'kd_register_glossary_taxonomy' );
			

Register an account to save your snippets or go Pro to get more features.