WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.57k stars 4.22k forks source link

Custom post types without `show_in_rest` cannot load editor #3066

Closed aduth closed 6 years ago

aduth commented 7 years ago

Previously: https://github.com/WordPress/gutenberg/issues/1342#issuecomment-319920850

This has been known and I assumed there was an issue, but a major blocking issue to relying on the REST API for building a post editor is that a custom post type must explicitly opt in to being available through the REST API, and therefore Gutenberg cannot load correctly otherwise.

Options for moving forward:

joehoyle commented 7 years ago

I created https://core.trac.wordpress.org/ticket/42785 to get some progress on better defaults for content included in the REST API. This doesn't quite address all the cases here such as "private" post types, which I think we can also push ahead.

danielbachhuber commented 6 years ago

Cross-posting from the Trac ticket.

I'm unconvinced that show_in_rest should become opt-out instead of opt-in.

Given custom post types probably have custom editor UI (metaboxes and otherwise), it seems unlikely that Gutenberg will be a drop-in replacement for the existing UI. Also, I'm concerned we'd unintentionally expose data we don't mean to expose.

Lastly, such a significant change certainly shouldn't be in a minor release.

For the purposes of Gutenberg, loading the Classic Editor for post types with show_in_rest=false seems sufficient to me.

dd32 commented 6 years ago

I'm unconvinced that show_in_rest should become opt-out instead of opt-in.

Given custom post types probably have custom editor UI (metaboxes and otherwise), it seems unlikely that Gutenberg will be a drop-in replacement for the existing UI. Also, I'm concerned we'd unintentionally expose data we don't mean to expose. [snip] For the purposes of Gutenberg, loading the Classic Editor for post types with show_in_rest=false seems sufficient to me.

I personally agree with the above reasoning, it seems that falling back to the Classic Editor for post_types not supporting show_in_rest is the most compatible and perhaps expected behaviour here.

That means that this has been fixed by 5390ea2c98b76905abe0bab5b8eaeed0a3576aa0 & #3146

dd32 commented 6 years ago

Going to close this in preference for https://core.trac.wordpress.org/ticket/42785 - Gutenberg acts correctly here, when/if cores defaults change those post_types will pick up Gutenberg if the other conditions are met.