0
X
Add Snippet To Project
New Project
Add To Existing Project
/**
* Registers the 'diet_type' taxonomy.
*
* @return void
*/
function wpturbo_register_diet_type_taxonomy() : void {
$labels = [
'name' => _x( 'Diet Types', 'Taxonomy Name', 'wpturbo' ),
'singular_name' => _x( 'Diet Type', 'Taxonomy Singular Name', 'wpturbo' ),
'menu_name' => __( 'Diet Types ', 'wpturbo' ),
'all_items' => __( 'All Diet Types ', 'wpturbo' ),
'parent_item' => __( 'Parent Diet Type ', 'wpturbo' ),
'parent_item_colon' => __( 'Parent Diet Type: ', 'wpturbo' ),
'new_item_name' => __( 'New Diet Type ', 'wpturbo' ),
'add_new_item' => __( 'Add New Diet Type ', 'wpturbo' ),
'edit_item' => __( 'Edit Diet Type ', 'wpturbo' ),
'update_item' => __( 'Update Diet Type ', 'wpturbo' ),
'view_item' => __( 'View Diet Type ', 'wpturbo' ),
'add_or_remove_items' => __( 'Add or Remove Diet Types ', 'wpturbo' ),
'choose_from_most_used' => __( 'Choose from most used Diet Types ', 'wpturbo' ),
'popular_items' => __( 'Popular Diet Types ', 'wpturbo' ),
'search_items' => __( 'Search Diet Types ', 'wpturbo' ),
'not_found' => __( 'Not Found ', 'wpturbo' ),
'no_terms' => __( 'No Diet Types ', 'wpturbo' ),
'items_list' => __( 'Diet Types List ', 'wpturbo' ),
'items_list_navigation' => __( 'Diet Types 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,
'rewrite' => [
'slug' => 'diet',
'with_front' => true,
'hierarchical' => false
],
'show_in_rest' => true,
'rest_base' => 'diet_type',
'rest_controller_class' => 'WP_REST_diet_type_Controller',
];
register_taxonomy( 'diet_type', ['post'], $args );
}
add_action( 'init', 'wpturbo_register_diet_type_taxonomy' );