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?
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?
Yes, you can disable it.
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.