In WordPress, the Gutenberg (Block) Editor is the default editor for posts and pages. But there are cases where you may prefer the Classic Editor, especially for specific pages that use shortcodes, custom layouts.
By default, Gutenberg is enabled globally for all post types that support it. However, with just a few lines of code, you can disable the Gutenberg editor for selected pages only, while keeping it active everywhere else.
Solution: Disable Gutenberg for Specific Page IDs
This simple code snippet helps you turn off the Gutenberg editor for particular pages by checking their IDs.
/**
* Disable Gutenberg editor for specific page IDs
*/
function ts_disable_gutenberg_for_specific_pages( $use_block_editor, $post ) {
// Replace with the IDs of pages where Gutenberg should be disabled
$excluded_ids = array( 1716, 223, 5378 );
if ( $post->post_type === 'page' && in_array( $post->ID, $excluded_ids ) ) {
return false; // Disable Gutenberg
}
return $use_block_editor; // Keep Gutenberg enabled elsewhere
}
add_filter( 'use_block_editor_for_post', 'ts_disable_gutenberg_for_specific_pages', 10, 2 );
Output
Once this snippet is active, the pages defined in the code will open in the Classic Editor. All other pages and posts will continue using Gutenberg.





