WordPress 5.0 has just been released, however, not everyone loves the new block editor – Gutenberg. This article will guide you how to simply disable Gutenberg with just one line of code, no plugins needed.

How to disable Gutenberg without using plugins
How to disable Gutenberg without using plugins

Why disable Gutenberg?

Gutenberg is the new editor added in WordPress 5.0. This editor promises to bring a whole new change and experience to users.

Nevertheless, after launching, it received plenty of criticism (more than praises) as it caused some problems for users, such as:

  • Unable to use powerful features of the editor toolbar brought by the TinyMCE Advanced plugin.
  • Can’t integrate the short-code buttons from other plugins into the editor toolbar.
  • Heavy JavaScript features make typing quite slow.
  • Articles editing, images inserting are a bit more difficult than the previous editor.
  • Meta boxes are not always well supported.
  • The WordPress 5.0.1 conflicts with Yoast SEO plugin 9.2.1
  • There are other conflicted plugins such as ACF, WPML

Therefore, while Gutenberg is not really stable, it should be disabled. Otherwise, if you are using other plugins and you have conflicting problems, you should disable it and go back to the old editor interface.

How to disable Gutenberg via code?

It’s simple to disable Gutenberg, all you need to do is add the following code into the functions.php file in your theme:

add_filter( 'use_block_editor_for_post', '__return_false' );

This code will hook into the use_block_editor_for_post filter to change the decision whether to use Gutenberg when writing articles or not. The __return_false function is a WordPress’ built-in function, which returns false, i.e. does not use Gutenberg.

If you want to disable Gutenberg for a specific post type, use the code below:

add_filter( 'use_block_editor_for_post_type', function( $enabled, $post_type ) {
    return 'your_post_type' === $post_type ? false : $enabled;
}, 10, 2 );

Simple, isn’t it? No need to install any plugins for the site!

How to disable Gutenberg completely?

Have to mention, even though the above code disables Gutenberg while editing articles, it doesn’t completely remove Gutenberg’s resources such as enqueued JavaScript file, CSS in admin and on the front-end.

To do that, we need to write more code. The easiest way to disable Gutenberg is to install an available plugin, Disable Gutenberg.

This plugin will completely disable Gutenberg and restores the default classic editor. It also disables all JavaScript and CSS files that are enqueued on the front end. Using Disable Gutenberg will help you save requests on the front end and help your website load faster.

Enjoy your time with Gutenberg!

Leave a Reply