Creating a separate taxonomy that operates independently from posts has its benefits. This allows you to focus on your posts, specifically writing blog content. It uses Gutenberg instead of the WordPress Classic Editor, and if you’re using Kadence free or pro, you will have access to all of their blocks. This plugin also works with other WordPress themes.
Setting up a custom recipe post type (taxonomy) without using a complicated Custom Post Type UI plugin is very easy. There are a few ways to add custom post types, some being very complicated, but we will cover two simple options.
Instructions
Let’s get started:
Because your function.php is connected to your theme and changes can be lost after updates, we will use Code Snippets to add the extra functionality.
NOTE: For caching, we suggest using LiteSpeed Caching, which is free forever and should be used if your server uses it. If your server doesn’t use LiteSpeed, an alternative is to use WP Rocket. Unfortunately, there is no free version, but it is worth every penny.
Layout
The image below shows what the new taxonomies provide after saving. You can carefully change the taxonomies in the Code Snippets, add more, and remove what you don’t need.

HTML Code
add_action('init', function() {
register_post_type('recipe', [
'label' => __('Recipes', 'txtdomain'),
'public' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-food',
'supports' => ['title', 'editor', 'thumbnail', 'author', 'revisions', 'excerpt', 'comments'],
'show_in_rest' => true,
'rewrite' => ['slug' => 'recipes'],
'taxonomies' => ['recipe_cuisines', 'recipe_courses', 'recipe_dietaries', 'recipe_badges', 'recipe_quickness', 'recipe_holidays', 'recipe_difficulties', 'recipe_free_from', 'recipe_cooking_methods'],
'labels' => [
'singular_name' => __('Recipe', 'txtdomain'),
'add_new_item' => __('Add new Recipe', 'txtdomain'),
'new_item' => __('New Recipe', 'txtdomain'),
'view_item' => __('View Recipe', 'txtdomain'),
'not_found' => __('No Recipes found', 'txtdomain'),
'not_found_in_trash' => __('No Recipes found in trash', 'txtdomain'),
'all_items' => __('All Recipes', 'txtdomain'),
'insert_into_item' => __('Insert into recipe', 'txtdomain')
],
]);
register_taxonomy('recipe_cooking_method', ['recipe'], [
'label' => __('Cooking Methods', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'cooking-methods'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Cooking Method', 'txtdomain'),
'all_items' => __('All Cooking Methods', 'txtdomain'),
'edit_item' => __('Edit Cooking Method', 'txtdomain'),
'view_item' => __('View Cooking Method', 'txtdomain'),
'update_item' => __('Update Cooking Method', 'txtdomain'),
'add_new_item' => __('Add New Cooking Method', 'txtdomain'),
'new_item_name' => __('New Cooking Method Name', 'txtdomain'),
'search_items' => __('Search Cooking Methods', 'txtdomain'),
'parent_item' => __('Parent Cooking Method', 'txtdomain'),
'parent_item_colon' => __('Parent Cooking Method:', 'txtdomain'),
'not_found' => __('No Cooking Methods found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_cooking_method', 'recipe');
register_taxonomy('recipe_cuisine', ['recipe'], [
'label' => __('Cuisines', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'cuisine'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Cuisine', 'txtdomain'),
'all_items' => __('All Cuisines', 'txtdomain'),
'edit_item' => __('Edit Cuisine', 'txtdomain'),
'view_item' => __('View Cuisine', 'txtdomain'),
'update_item' => __('Update Cuisine', 'txtdomain'),
'add_new_item' => __('Add New Cuisine', 'txtdomain'),
'new_item_name' => __('New Cuisine Name', 'txtdomain'),
'search_items' => __('Search Cuisines', 'txtdomain'),
'popular_items' => __('Popular Cuisines', 'txtdomain'),
'separate_items_with_commas' => __('Separate cuisines with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used Cuisines', 'txtdomain'),
'not_found' => __('No Cuisines found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_cuisine', 'recipe');
register_taxonomy('recipe_course', ['recipe'], [
'label' => __('Courses', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'course'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Course', 'txtdomain'),
'all_items' => __('All Courses', 'txtdomain'),
'edit_item' => __('Edit Course', 'txtdomain'),
'view_item' => __('View Course', 'txtdomain'),
'update_item' => __('Update Course', 'txtdomain'),
'add_new_item' => __('Add New Course', 'txtdomain'),
'new_item_name' => __('New Course Name', 'txtdomain'),
'search_items' => __('Search Courses', 'txtdomain'),
'popular_items' => __('Popular Courses', 'txtdomain'),
'separate_items_with_commas' => __('Separate courses with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used Courses', 'txtdomain'),
'not_found' => __('No Courses found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_course', 'recipe');
register_taxonomy('recipe_dietary', ['recipe'], [
'label' => __('Dietaries', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'dietary'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Dietary', 'txtdomain'),
'all_items' => __('All Dietaries', 'txtdomain'),
'edit_item' => __('Edit Dietary', 'txtdomain'),
'view_item' => __('View Dietary', 'txtdomain'),
'update_item' => __('Update Dietary', 'txtdomain'),
'add_new_item' => __('Add New Dietary', 'txtdomain'),
'new_item_name' => __('New Dietary Name', 'txtdomain'),
'search_items' => __('Search Dietaries', 'txtdomain'),
'popular_items' => __('Popular Dietaries', 'txtdomain'),
'separate_items_with_commas' => __('Separate dietaries with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used Dietaries', 'txtdomain'),
'not_found' => __('No Dietaries found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_dietary', 'recipe');
register_taxonomy('recipe_difficulty', ['recipe'], [
'label' => __('Difficulties', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'difficulty'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Difficulty', 'txtdomain'),
'all_items' => __('All Difficulties', 'txtdomain'),
'edit_item' => __('Edit Difficulty', 'txtdomain'),
'view_item' => __('View Difficulty', 'txtdomain'),
'update_item' => __('Update Difficulty', 'txtdomain'),
'add_new_item' => __('Add New Difficulty', 'txtdomain'),
'new_item_name' => __('New Difficulty Name', 'txtdomain'),
'search_items' => __('Search Difficulties', 'txtdomain'),
'popular_items' => __('Popular Difficulties', 'txtdomain'),
'separate_items_with_commas' => __('Separate difficulties with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used difficulties', 'txtdomain'),
'not_found' => __('No Difficulties found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_difficulty', 'recipe');
register_taxonomy('recipe_free_from', ['recipe'], [
'label' => __('Free From', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'free-from'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Free From', 'txtdomain'),
'all_items' => __('All Free From', 'txtdomain'),
'edit_item' => __('Edit Free From', 'txtdomain'),
'view_item' => __('View Free From', 'txtdomain'),
'update_item' => __('Update Free From', 'txtdomain'),
'add_new_item' => __('Add New Free From', 'txtdomain'),
'new_item_name' => __('New Free From Name', 'txtdomain'),
'search_items' => __('Search Free From', 'txtdomain'),
'popular_items' => __('Popular Free From', 'txtdomain'),
'separate_items_with_commas' => __('Separate free from with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used free from', 'txtdomain'),
'not_found' => __('No Free From found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_free_from', 'recipe');
register_taxonomy('recipe_holidays', ['recipe'], [
'label' => __('Holidays', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'holiday'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Holiday', 'txtdomain'),
'all_items' => __('All Holidays', 'txtdomain'),
'edit_item' => __('Edit Holiday', 'txtdomain'),
'view_item' => __('View Holiday', 'txtdomain'),
'update_item' => __('Update Holiday', 'txtdomain'),
'add_new_item' => __('Add New Holiday', 'txtdomain'),
'new_item_name' => __('New Holiday Name', 'txtdomain'),
'search_items' => __('Search Holidays', 'txtdomain'),
'popular_items' => __('Popular Holidays', 'txtdomain'),
'separate_items_with_commas' => __('Separate holidays with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used holidays', 'txtdomain'),
'not_found' => __('No Holidays found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_holidays', 'recipe');
register_taxonomy('recipe_quickness', ['recipe'], [
'label' => __('Quickness', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'quickness'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Quickness', 'txtdomain'),
'all_items' => __('All Quickness', 'txtdomain'),
'edit_item' => __('Edit Quickness', 'txtdomain'),
'view_item' => __('View Quickness', 'txtdomain'),
'update_item' => __('Update Quickness', 'txtdomain'),
'add_new_item' => __('Add New Quickness', 'txtdomain'),
'new_item_name' => __('New Quickness Name', 'txtdomain'),
'search_items' => __('Search Quickness', 'txtdomain'),
'popular_items' => __('Popular Quickness', 'txtdomain'),
'separate_items_with_commas' => __('Separate quickness with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used quickness', 'txtdomain'),
'not_found' => __('No Quickness found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_quickness', 'recipe');
register_taxonomy('recipe_badges', ['recipe'], [
'label' => __('Badges', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'recipe-badges'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Badge', 'txtdomain'),
'all_items' => __('All Badges', 'txtdomain'),
'edit_item' => __('Edit Badge', 'txtdomain'),
'view_item' => __('View Badge', 'txtdomain'),
'update_item' => __('Update Badge', 'txtdomain'),
'add_new_item' => __('Add New Badge', 'txtdomain'),
'new_item_name' => __('New Badges Name', 'txtdomain'),
'search_items' => __('Search Badges', 'txtdomain'),
'popular_items' => __('Popular Badges', 'txtdomain'),
'separate_items_with_commas' => __('Separate badges with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used badges', 'txtdomain'),
'not_found' => __('No Badge found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_badges', 'recipe');
});
Changing Or Adding Recipe Taxonomies:
Changing or adding taxonomies is very easy; each taxonomy code is divided into sections. To start, we need to work on the function, which is the first section. To add another recipe category, we need to add a little bit of code on the line below.
Let’s say you want to add Tags. Copy one of the sequences, i.e., 'recipe_courses'
, paste it at the end of the row, and change the end word to tags.
['recipe_cuisines', 'recipe_courses', 'recipe_dietaries', 'recipe_badges', 'recipe_quickness', 'recipe_holidays', 'recipe_difficulties', 'recipe_free_from', 'recipe_cooking_methods', 'recipe_tags'],
We are now going to register the taxonomy. Start by copying the last section, 'recipe_badges'
, then copy this code onto a Note Pad on your PC.
Now change all the words Badges to Tags, and remember to keep the changes singular and plural.
When all the words have been changed, copy this section and add it below the badges section.
register_taxonomy('recipe_badges', ['recipe'], [
'label' => __('Badges', 'txtdomain'),
'hierarchical' => true,
'rewrite' => ['slug' => 'recipe-badges'],
'show_admin_column' => true,
'show_in_rest' => true,
'labels' => [
'singular_name' => __('Badge', 'txtdomain'),
'all_items' => __('All Badges', 'txtdomain'),
'edit_item' => __('Edit Badge', 'txtdomain'),
'view_item' => __('View Badge', 'txtdomain'),
'update_item' => __('Update Badge', 'txtdomain'),
'add_new_item' => __('Add New Badge', 'txtdomain'),
'new_item_name' => __('New Badges Name', 'txtdomain'),
'search_items' => __('Search Badges', 'txtdomain'),
'popular_items' => __('Popular Badges', 'txtdomain'),
'separate_items_with_commas' => __('Separate badges with comma', 'txtdomain'),
'choose_from_most_used' => __('Choose from most used badges', 'txtdomain'),
'not_found' => __('No Badge found', 'txtdomain'),
]
]);
register_taxonomy_for_object_type('recipe_badges', 'recipe');
Alternatively, if you don’t want a section that we have listed, you can delete it or change it to the taxonomy you want.
Ensuring The Code Works:
To ensure the code works at its optimum, bear in mind these cautions: