How to disable Gutenberg editor?

The question:

As the 5.0 is getting real, and so is Gutenberg…

Is it possible to disable Gutenberg and use previous TinyMCE editor?

How to do this?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Yes, you can disable it.

You can do this with code

If you want to disable it globally, you can use this code:

if ( version_compare($GLOBALS['wp_version'], '5.0-beta', '>') ) {
    // WP > 5 beta
    add_filter( 'use_block_editor_for_post_type', '__return_false', 100 );
} else {
    // WP < 5 beta
    add_filter( 'gutenberg_can_edit_post_type', '__return_false' );
}

And if you want to disable it only for given post type, you can use:

function my_disable_gutenberg_for_post_type( $is_enabled, $post_type ) {
    if ( 'page' == $post_type ) {  // disable for pages, change 'page' to you CPT slug
        return false;
    }

    return $is_enabled;
}
if ( version_compare($GLOBALS['wp_version'], '5.0-beta', '>') ) {
    // WP > 5 beta
    add_filter( 'use_block_editor_for_post_type', 'my_disable_gutenberg_for_post_type', 10, 2 );
} else {
    // WP < 5 beta
    add_filter( 'gutenberg_can_edit_post_type', 'my_disable_gutenberg_for_post_type', 10, 2 );
}

PS. If you don’t want to support older versions, you can ignore filters beginning with ‘gutenberg_’, so no version checking is needed in such case.

Or using one of existing plugins

  1. Classic Editor
  2. Disable Gutenberg
  3. Guten Free Options
  4. Gutenberg Ramp

Method 2

Generally the answer is no. Gutenberg stores content in a different format than how the pre 5.0 editor did. YMMV significantly if you try to disable gutenberg after content was already created, things might work for core blocks, but blocks created by plugins, who knows.

Now if the question is about disabling before having any content edited in gutenberg, then you have a better chance with the other answers, but this is going to be a short term bandaid fix and is not a long term proper strategy.
In the long term all those options are not going to be tested against or just bit rot. And on top of that you might have a limited selection of themes and plugins you can work with.

5.0 have already hard coded gutenberging of sample content. you are not going to escape the need to use it by hacks.

If you want to use WordPress you should embrace its core features, and you do not want to build technical debt and be forced to migrate to gutenberg on a rush. It is better to just do it once it stabilizes and get done with it.

If you do not want to embrace WordPress core features, why do you use it?

Method 3

I just added this in my function.php and it works great

add_filter('use_block_editor_for_post', '__return_false');

Method 4

You can disable Gutenberg by installing the Classic Editor plugin
https://wordpress.org/plugins/classic-editor/
This will disable the Gutenberg Editor.

Thanks


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment