0
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 Taxonomys', 'Taxonomy Name', 'wpturbo' ),
'singular_name' => _x( 'My Taxonomy', 'Taxonomy Singular Name', 'wpturbo' ),
'menu_name' => __( 'My Taxonomys ', 'wpturbo' ),
'all_items' => __( 'All My Taxonomys ', 'wpturbo' ),
'parent_item' => __( 'Parent My Taxonomy ', 'wpturbo' ),
'parent_item_colon' => __( 'Parent My Taxonomy: ', 'wpturbo' ),
'new_item_name' => __( 'New My Taxonomy ', 'wpturbo' ),
'add_new_item' => __( 'Add New My Taxonomy ', 'wpturbo' ),
'edit_item' => __( 'Edit My Taxonomy ', 'wpturbo' ),
'update_item' => __( 'Update My Taxonomy ', 'wpturbo' ),
'view_item' => __( 'View My Taxonomy ', 'wpturbo' ),
'add_or_remove_items' => __( 'Add or Remove My Taxonomys ', 'wpturbo' ),
'choose_from_most_used' => __( 'Choose from most used My Taxonomys ', 'wpturbo' ),
'popular_items' => __( 'Popular My Taxonomys ', 'wpturbo' ),
'search_items' => __( 'Search My Taxonomys ', 'wpturbo' ),
'not_found' => __( 'Not Found ', 'wpturbo' ),
'no_terms' => __( 'No My Taxonomys ', 'wpturbo' ),
'items_list' => __( 'My Taxonomys List ', 'wpturbo' ),
'items_list_navigation' => __( 'My Taxonomys List Navigation ', 'wpturbo' ),
];
$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' => 'my_taxonomy',
'rest_controller_class' => 'WP_REST_my_taxonomy_Terms_Controller',
];
register_taxonomy( 'my_taxonomy', ['post'], $args );
}
add_action( 'init', 'wpturbo_register_my_taxonomy' );
Super human