Support » Plugin: Gutenberg » Gutenberg and custom post type

  • Resolved cinematic

    (@cinematic)


    I have just installed gutenberg editor in order to test it. It doesn’t work for my custom post types. I have a glossary installed and the glossary items work with classic editor only. I am a bit worried that – if Gutenberg is going to be the core editor – there will be problems with custom post types not meeting all the gutenberg requirements.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Marius L. J.

    (@clorith)

    Hi,

    There’s nothing to worry about, if WordPress detects a post type isn’t compatible with Gutenberg, it will default to using the classic editor so you’ll always have access to your content (the classic editor won’t be removed, it’s just getting a new skin with Gutenberg, so to speak).

    There are a few things that may disable Gutenberg, when creating a post type you need to enable the REST API (The show_in_rest option must be set to true).
    Meta boxes may also opt-out of the new editor, in which case the classic one will also be used.

    In your case, it’s likely the first, that you need to enable the REST API for your post type before it will work.

    Hi Marius,

    I am reading this with interest. the fact that Gutenberg will fallback to the current editor, if a post type does not conform to certain requirements will happen without the Classic editor installed suggests that the current editor is/will be still present in core but generally overridden by Gutenberg.

    Also, if you disable the Editor content text area, as you can do with Toolset Types, you set up your CPT to not conform to the requirements for Gutenberg. You might do this if you want to restrict the backend to a form that takes specific data values for a product or item. Somebody might find this useful.

    There is a filter that can be applied to completely disable Gutenberg:

    add_filter(‘gutenberg_can_edit_post_type’, ‘__return_false’);

    I have tested this and it works.

    I understand that the name of this may be changed on the release of WordPress 5. Can you confirm and is there any information on what the filter will be called?

    Much appreciated if you can give me an answer. I have been seeking an answer on this for a while.

    Moderator Marius L. J.

    (@clorith)

    You are correct on all the points you mentioned, yes.

    As for the filter, we’ve not landed on what it will be, but there are a few options up in the air and it seems likely that we will replace gutenberg with block_editor in hooks and filters. Of course this isn’t confirmed, just the current view on things.

    Cheers Marius,

    That helps a lot in how we can mange working with themes and transitions between sites that are partially using Gutenberg and those that need to still work with the current editor.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Gutenberg and custom post type’ is closed to new replies.