Gutenberg, the new editor that was introduced into WordPress since version 5.0 has a lot of cool features. But it in some cases, when you donโt actually need it, it still bloats your website with unused CSS and JS.
Here are the two easy ways to disable Gutenberg:
By pasting this PHP code into your functions.php:
// Disable Gutenberg on the back end
add_filter( 'use_block_editor_for_post', '__return_false' );
// Disable Gutenberg for widgets
add_filter( 'use_widgets_block_editor', '__return_false' );
add_action( 'wp_enqueue_scripts', function() {
// Remove CSS on the front end
wp_dequeue_style( 'wp-block-library' );
// Remove Gutenberg theme
wp_dequeue_style( 'wp-block-library-theme' );
// Remove inline global CSS on the front end
wp_dequeue_style( 'global-styles' );
// Remove classic-themes CSS for backwards compatibility for button blocks
wp_dequeue_style( 'classic-theme-styles' );
}, 20 );
Using PowerTools
PowerTools is a free WordPress plugin that is aimed to improve your productivity by solving some of the tasks that you encounter when building a website. I created it for myself and published the souce code on GitHub.
It allows you to disable Gutenberg just by ticking one checkbox:
All you need to do is download the plugin from GitHub, install it and find Gutenberg Disabler in the list of the tools that the plugin features.
Itโs that easy!
Top comments (0)