darrenjacoby / intervention

WordPress plugin to configure wp-admin and application state using a single config file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gutenberg editor in custom post type

dooke opened this issue · comments

commented

Hello,

Great work this code is awesome!

I have a problem with the options show_in_rest
According to the documentation https://developer.wordpress.org/reference/functions/register_post_type/ if we set this option the post type will be available in block editor.

Do you have an issue / solution for this.

Thanks a lot ;)

Hey @dooke ,

Thanks!

This should be available when registering a post type. You can assign as follows, if the post type is 'book';

'application.posts.book.show-in-rest' => true

or, as an array;

'application' => [
    'posts' => [
        'book' => [
            'show-in-rest' => true,
         ],
    ],
],

Let me know if that's working for you.

commented

Thank you!! It works.

So initial var / key in array have to replace '_' by '-'
show_in_rest
with
show-in-rest

Many thanks

Good to hear! It should work either way actually, but I'll test again to make sure that's the case.