Disabling the Block Editor for Specific Post Types
While the Block Editor (Gutenberg) is the default for modern WordPress, there are many situations where you want to disable it for a specific Custom Post Type (CPT).
This is especially common for CPTs that are data-driven and rely on Advanced Custom Fields (ACF) rather than long-form block content. For example, a CPT for "Events" might only have fields for Date, Time, and Location.
1. The "Why": A Simpler Editing Experience
- ACF-Driven Content: If all your data is in ACF meta boxes, the block editor is just empty space that confuses the client.
- Simple Post Types: For a "Team Member" CPT, you might only have a Title (Name) and a Featured Image. The block editor is unnecessary.
- Legacy Content: If you are migrating a site with lots of legacy shortcode-based content, it can be easier to keep the Classic Editor for that post type.
2. The "How": The use_block_editor_for_post_type Filter
The correct way to disable Gutenberg is with a PHP filter in your theme's functions.php. This filter allows you to conditionally enable or disable the block editor based on the post type.
Example: Disable for a CPT named "Event"
function my_disable_gutenberg_for_cpt( $is_enabled, $post_type ) {
// Target your specific post type slug
if ( 'event' === $post_type ) {
return false;
}
return $is_enabled;
}
add_filter( 'use_block_editor_for_post_type', 'my_disable_gutenberg_for_cpt', 10, 2 );
Example: Disable for Multiple Post Types
You can use an array to manage a list of post types where the block editor should be disabled.
function my_disable_gutenberg_for_multiple_cpts( $is_enabled, $post_type ) {
$disabled_post_types = array( 'event', 'team_member', 'testimonial' );
if ( in_array( $post_type, $disabled_post_types, true ) ) {
return false;
}
return $is_enabled;
}
add_filter( 'use_block_editor_for_post_type', 'my_disable_gutenberg_for_multiple_cpts', 10, 2 );
When you add this code, editing an "Event" will now load the familiar Classic Editor interface, placing your ACF meta boxes below the main content area.