#50151 closed defect (bug) (invalid)
use_block_editor_for_post_type filter always returns page or post as post_type
Reported by: | dingo_d | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.5 |
Component: | Editor | Keywords: | |
Focuses: | Cc: |
Description
I'm trying to enable the core editor only for one post type on a client project (want to transition to blocks piece by piece). So I've added the use_block_editor_for_post_type
filter, and set:
<?PHP /** * Register hooks */ public function register() : void { add_filter( 'use_block_editor_for_post_type', [ $this, 'disable_gutenberg' ], 10, 2 ); } public function disable_gutenberg( bool $use_block_editor, string $post_type ) { if ( in_array( $post_type, [ 'post', 'page' ], true ) ) { return false; } return $use_block_editor; }
And I check posts, and pages, they don't have GB (which is what I want). But my custom post types, which have editor enabled, also show classic editor.
So I added an error_log in the filter and all the $post_type
variable value when I'm at the new page of the CPT is page
(except when I'm on a post, then it's post
).
Is this a bug or?
Change History (2)
Note: See
TracTickets for help on using
tickets.
My bad, I didn't notice that
show_in_rest
parameter was set to false in my CPTs 🤦🏼♂️