This snippet disables the Gutenberg block editor for selected post types and restores the classic editor interface. It is useful when you want to keep the block editor enabled for posts but use the classic editor for pages or custom post types.
add_filter( 'use_block_editor_for_post_type', 'wpf_disable_gutenberg_for_post_types', 10, 2 );
function wpf_disable_gutenberg_for_post_types( $use_block_editor, $post_type ) {
$disabled_post_types = array( 'page', 'product' );
if ( in_array( $post_type, $disabled_post_types, true ) ) {
return false;
}
return $use_block_editor;
}
Tested on
WordPress 6.8
Reported by the author on December 1, 2026. WPFolks has not verified this.
Not tested against WordPress 7.1.5. It may still work.
