WP TEST

Home » Snippets » WP TEST
0

Created with:

Taxonomy generator

Visibility: 

public

Creator: tayyab

Customize with WPTurbo AI
X

Add Snippet To Project

New Project
Add To Existing Project
				/**
 * Registers the 'my_taxonomy' taxonomy.
 * 
 * @return void
 */
function wpturbo_register_my_taxonomy() : void {
	$labels = [
		'name' => _x( 'My Taxonomies', 'Taxonomy Name', 'wpturbo' ),
		'singular_name' => _x( 'My Taxonomy', 'Taxonomy Singular Name', 'wpturbo' ),
		'menu_name' => __( 'Taxonomies ', 'wpturbo' ),
		'all_items' => __( 'All Taxonomies ', 'wpturbo' ),
		'parent_item' => __( 'Parent Item ', 'wpturbo' ),
		'parent_item_colon' => __( 'Parent Item: ', 'wpturbo' ),
		'new_item_name' => __( 'New Taxonomy ', 'wpturbo' ),
		'add_new_item' => __( 'Add New ', 'wpturbo' ),
		'edit_item' => __( 'Edit Taxonomy ', 'wpturbo' ),
		'update_item' => __( 'Update ', 'wpturbo' ),
		'view_item' => __( 'View Taxonomy ', 'wpturbo' ),
		'add_or_remove_items' => __( 'Add Or Remove Items ', 'wpturbo' ),
		'choose_from_most_used' => __( 'Choose From Most Used ', 'wpturbo' ),
		'popular_items' => __( 'Popular Items ', 'wpturbo' ),
		'search_items' => __( 'Search Items ', 'wpturbo' ),
		'not_found' => __( 'Not Found ', 'wpturbo' ),
		'no_terms' => __( 'No Items ', 'wpturbo' ),
		'items_list' => __( 'Items List ', 'wpturbo' ),
		'items_list_navigation' => __( 'Items List Navigation ', 'wpturbo' ),
	];

	$args = [
		'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,
		'rest_base' => 'my_taxonomy',
		'rest_controller_class' => 'WP_REST_my_taxonomy_Controller',
	];

	register_taxonomy( 'my_taxonomy', ['post'], $args );
}
add_action( 'init', 'wpturbo_register_my_taxonomy' );
			

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