Error with core patterns
-
- I created a custom post type and added support for patterns.
- I created and added a restaurant-single.php inc/patterns folder.
- I also added restaurant-single file to patterns folder.
- I then created this code:
// Register Custom Post Type function register_restaurant_post_type() { $args = array( 'public' => true, 'label' => 'Restaurant', 'menu_icon' => 'dashicons-food', 'show_in_rest' => true, 'supports' => array('featured-image', 'thumbnail', 'custom-fields', 'excerpt', 'title', 'editor'), 'template' => array( array('core/patterns', array( 'slug' => 'twentytwentytwo/restaurant-single', )), ), ); register_post_type('restaurant', $args); } add_action('init', 'register_restaurant_post_type');But unfortunately I was getting the following error message while to created a post in Restaurant:
Your site doesn’t include support for the “core/patterns” block. You can leave this block intact or remove it entirely.
I am not sure what is missing. If I comment out
'template' => array( array('core/patterns', array( 'slug' => 'twentytwentytwo/restaurant-single', )), ),the error goes away but then it will defeats the purpose of creating a reusable pattern.
I am not sure why it’s saying the “site doesn’t include support for the core/patterns block.” I will appreciate some help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Error with core patterns’ is closed to new replies.