The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Disable Gutenberg Editor for Specific Post Types

Shared by Amit Dholiya · December 1, 2026 · @use_block_editor_for_post_type

1 view
1 upvote
Back to Snippets

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.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments

Proudly supported by