The Gutenberg (Block) Editor is WordPress’s default editor since version 5.0. While it’s powerful and modern, many developers and clients prefer the Classic Editor or a custom page builder.
To Permanently Disable the Gutenberg Editor in WordPress Use Below Code
Add code to your child theme’s functions.php
file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Avoid adding custom code directly to your parent theme’s functions.php
file as this will be wiped entirely when you update the theme.
Disable Gutenberg Globally Using Code
add_filter('use_block_editor_for_post', '__return_false', 10);
You can also remove the block editor styles to prevent unnecessary CSS:
function remove_block_editor_assets() {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
wp_dequeue_style('global-styles');
wp_dequeue_script('wp-blocks');
}
add_action('wp_enqueue_scripts', 'remove_block_editor_assets', 100);
This code will
- This disables Gutenberg for all post types.
Disable Gutenberg for Specific Post Types
Let’s say you want Gutenberg only for post
, but disable it for page
or a custom post type like event
.
function disable_gutenberg_for_custom_post_types($is_enabled, $post_type) {
$disabled_types = ['page', 'event']; // Add your CPTs here
if (in_array($post_type, $disabled_types)) {
return false;
}
return $is_enabled;
}
add_filter('use_block_editor_for_post_type', 'disable_gutenberg_for_custom_post_types', 10, 2);
Also disable Gutenberg on widget screens (since WP 5.8):
add_filter('gutenberg_use_widgets_block_editor', '__return_false');
add_filter('use_widgets_block_editor', '__return_false');
Disable Gutenberg Based on User Role
Want only admins to use Gutenberg? Here’s how to allow/block based on role:
function disable_gutenberg_for_roles($is_enabled, $post) {
if (is_admin()) {
$current_user = wp_get_current_user();
if (!in_array('administrator', $current_user->roles)) {
return false;
}
}
return $is_enabled;
}
add_filter('use_block_editor_for_post', 'disable_gutenberg_for_roles', 10, 2);
Disable Gutenberg Completely via Plugin (Cleaner Setup)
Create a must-use plugin (MU plugin):
Step 1: Create a file named disable-gutenberg.php
in /wp-content/mu-plugins/
<?php
/*
Plugin Name: Disable Gutenberg Permanently
Description: Permanently disables the Gutenberg block editor site-wide.
*/
add_filter('use_block_editor_for_post', '__return_false');
add_filter('use_block_editor_for_post_type', '__return_false');
add_filter('gutenberg_use_widgets_block_editor', '__return_false');
add_filter('use_widgets_block_editor', '__return_false');
// Remove block library CSS
add_action('wp_enqueue_scripts', function () {
wp_dequeue_style('wp-block-library');
wp_dequeue_style('wp-block-library-theme');
}, 100);
Why MU plugin?
- It can’t be accidentally disabled.
- Loads automatically and early.