# Recipes Post Type With Cuisine and Course

> Registers a "Recipes" post type with Cuisine and Course taxonomies, comments and featured images, under /recipes/.

- Type: PHP
- Runs: Run everywhere
- Category: [Custom Post Types & Fields](https://wpide.com/library/category/post-types/)
- Tags: custom-post-types, recipes, food
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/cpt-recipes/

## Code

```php
// Names used in labels and URLs: edit to suit.
$wpide_type = array(
    'name'     => 'recipe', // Internal name: lowercase, max 20 characters, never change it once you have content.
    'singular' => 'Recipe',
    'plural'   => 'Recipes',
    'slug'     => 'recipes',
);

add_action( 'init', function () use ( $wpide_type ) {
    $s = $wpide_type['singular'];
    $p = $wpide_type['plural'];

    register_post_type( $wpide_type['name'], array(
        'labels'        => array(
            'name'                  => $p,
            'singular_name'         => $s,
            'menu_name'             => $p,
            'add_new_item'          => "Add New $s",
            'edit_item'             => "Edit $s",
            'new_item'              => "New $s",
            'view_item'             => "View $s",
            'view_items'            => "View $p",
            'all_items'             => "All $p",
            'search_items'          => "Search $p",
            'not_found'             => 'Nothing found.',
            'not_found_in_trash'    => 'Nothing found in Trash.',
            'archives'              => "$s Archives",
            'attributes'            => "$s Attributes",
            'insert_into_item'      => "Insert into $s",
            'uploaded_to_this_item' => "Uploaded to this $s",
            'item_published'        => "$s published.",
            'item_updated'          => "$s updated.",
        ),
        'public'        => true,
        'has_archive'   => $wpide_type['slug'],
        'rewrite'       => array( 'slug' => $wpide_type['slug'], 'with_front' => false ),
        'show_in_rest'  => true,
        'menu_icon'     => 'dashicons-carrot',
        'menu_position' => 29,
        'supports'      => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'revisions' ),
    ) );

    register_taxonomy( 'cuisine', $wpide_type['name'], array(
        'labels'            => array(
            'name'          => 'Cuisines',
            'singular_name' => 'Cuisine',
            'menu_name'     => 'Cuisines',
            'all_items'     => 'All Cuisines',
            'edit_item'     => 'Edit Cuisine',
            'view_item'     => 'View Cuisine',
            'update_item'   => 'Update Cuisine',
            'add_new_item'  => 'Add New Cuisine',
            'new_item_name' => 'New Cuisine Name',
            'search_items'  => 'Search Cuisines',
            'not_found'     => 'No cuisines found.',
            'parent_item'   => 'Parent Cuisine',
        ),
        'hierarchical'      => true,
        'public'            => true,
        'rewrite'           => array( 'slug' => 'cuisine', 'with_front' => false ),
        'show_admin_column' => true,
        'show_in_rest'      => true,
    ) );

    register_taxonomy( 'recipe_course', $wpide_type['name'], array(
        'labels'            => array(
            'name'          => 'Courses',
            'singular_name' => 'Course',
            'menu_name'     => 'Courses',
            'all_items'     => 'All Courses',
            'edit_item'     => 'Edit Course',
            'view_item'     => 'View Course',
            'update_item'   => 'Update Course',
            'add_new_item'  => 'Add New Course',
            'new_item_name' => 'New Course Name',
            'search_items'  => 'Search Courses',
            'not_found'     => 'No courses found.',
            'parent_item'   => 'Parent Course',
        ),
        'hierarchical'      => true,
        'public'            => true,
        'rewrite'           => array( 'slug' => 'recipe-course', 'with_front' => false ),
        'show_admin_column' => true,
        'show_in_rest'      => true,
    ) );
} );
```

## Notes

Add the Recipe Details meta box and Recipe schema snippets for times, servings and rich results.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Recipes Post Type With Cuisine and Course" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
