Wordpress - How to disable Gutenberg editor?
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
- Classic Editor
- Disable Gutenberg
- Guten Free Options
- Gutenberg Ramp
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?
I just added this in my function.php and it works great
add_filter('use_block_editor_for_post', '__return_false');