WP 5.0+
PHP 7.4+
Disable Gutenberg for Specific Post Types
Conditionally disable the Block Editor and revert to the Classic Editor (or raw HTML) using the use_block_editor_for_post_type filter.
// Code goes here Logic Flow
Page Load (post_type)
Filter: use_block_editor...
in_array( type, disabled )?
YES
return false
Classic Editor
Classic Editor
NO
return default
Block Editor
Block Editor
How to Implement
1
Locate your functions file
Open your active theme's folder and find functions.php. Alternatively, create a site-specific plugin.
2
Customize the Array
Change ['product', 'event'] to the slugs of the Post Types you want to target.
// Example for a simple 'Portfolio' site
disabled_types = [ 'portfolio_project', 'testimonial' ];
disabled_types = [ 'portfolio_project', 'testimonial' ];
Did this snippet work for you?
Help other developers by verifying this solution.