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