Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Recipe Category Taxonomy

Custom taxonomy for recipes custom post type

if ( ! function_exists( 'recipe_category' ) ) {

// Register Custom Taxonomy
function recipe_category() {

	$labels = array(
		'name'                       => _x( 'Recipe Categories', 'Taxonomy General Name', 'cocktail_slices' ),
		'singular_name'              => _x( 'Recipe Category', 'Taxonomy Singular Name', 'cocktail_slices' ),
		'menu_name'                  => __( 'Recipe Category', 'cocktail_slices' ),
		'all_items'                  => __( 'All Recipe Categories', 'cocktail_slices' ),
		'parent_item'                => __( 'Parent Recipe Category', 'cocktail_slices' ),
		'parent_item_colon'          => __( 'Parent Recipe Category:', 'cocktail_slices' ),
		'new_item_name'              => __( 'New Recipe Category', 'cocktail_slices' ),
		'add_new_item'               => __( 'Add New Recipe Category', 'cocktail_slices' ),
		'edit_item'                  => __( 'Edit Recipe Category', 'cocktail_slices' ),
		'update_item'                => __( 'Update Recipe Category', 'cocktail_slices' ),
		'view_item'                  => __( 'View Recipe Category', 'cocktail_slices' ),
		'separate_items_with_commas' => __( 'Separate recipe categories with commas', 'cocktail_slices' ),
		'add_or_remove_items'        => __( 'Add or remove recipe categories', 'cocktail_slices' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'cocktail_slices' ),
		'popular_items'              => __( 'Popular Recipe Categories', 'cocktail_slices' ),
		'search_items'               => __( 'Search Recipe Categories', 'cocktail_slices' ),
		'not_found'                  => __( 'Not Found', 'cocktail_slices' ),
		'no_terms'                   => __( 'No recipe categories', 'cocktail_slices' ),
		'items_list'                 => __( 'Recipe Categories list', 'cocktail_slices' ),
		'items_list_navigation'      => __( 'Recipe Categories list navigation', 'cocktail_slices' ),
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
	);
	register_taxonomy( 'recipe_category', array( 'recipes' ), $args );

}
add_action( 'init', 'recipe_category', 0 );

}