CPT Recipe – Taxonomy Category
if ( ! function_exists( 'wpbscook_register_taxonomy_recipe_categories' ) ) {
// Register Custom Taxonomy
function wpbscook_register_taxonomy_recipe_categories() {
$labels = array(
'name' => _x( 'Categories', 'Taxonomy General Name', 'wpbscook' ),
'singular_name' => _x( 'Category', 'Taxonomy Singular Name', 'wpbscook' ),
'menu_name' => __( 'Categories', 'wpbscook' ),
'all_items' => __( 'All categories', 'wpbscook' ),
'parent_item' => __( 'Parent category', 'wpbscook' ),
'parent_item_colon' => __( 'Parent category:', 'wpbscook' ),
'new_item_name' => __( 'New category name', 'wpbscook' ),
'add_new_item' => __( 'Add new categor', 'wpbscook' ),
'edit_item' => __( 'Edit categor', 'wpbscook' ),
'update_item' => __( 'Update categor', 'wpbscook' ),
'separate_items_with_commas' => __( 'Separate categories with commas', 'wpbscook' ),
'search_items' => __( 'Search categories', 'wpbscook' ),
'add_or_remove_items' => __( 'Add or remove categories', 'wpbscook' ),
'choose_from_most_used' => __( 'Choose from the most used categories', 'wpbscook' ),
'not_found' => __( 'Not Found', 'wpbscook' ),
);
$rewrite = array(
'slug' => 'recipe_category',
'with_front' => true,
'hierarchical' => false,
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => false,
'rewrite' => $rewrite,
);
register_taxonomy( 'wpbscook_category', array( 'wpbscook_recipe' ), $args );
}
// Hook into the 'init' action
add_action( 'init', 'wpbscook_register_taxonomy_recipe_categories', 0 );
}