How to Disable Gutenberg Editor on WordPress without Plugin
? Gutenberg is now a Reality. You may want or don’t but you’ve to adopt this new Editor. Gary Pendergast announced that Classic Editor Plugin will work seamlessly and Officially supported alongside Gutenberg Plugin until December 31, 2021.
Simpliest Solution: Define “DISABLE_NAG_NOTICES" on wp-config.php file
define('DISABLE_NAG_NOTICES', true);
Gutenberg Released WordPress Core on 6th December 2018. WordPress has a majority Percentage of websites on the Internet. Many Established Website owners are thinking the way how to disable Gutenberg Editor and running website with Classic Editor Plugin.
How to Disable Gutenberg Editor on WordPress without Plugin
Because to be familiar with a new system will take time. Also, there are not enough resources for Gutenberg Editor on market. It will need a couple of for Users.
Gutenberg Plugin is about to cross 1M+ Active Installs. Immense popularity before releasing means a lot, people are trying to learn how it works.
I’m writing this article for those people who don’t like Gutenberg Editor ( this can be any reason ) and keep the Classic Editor.
? Try Easy Blocks for Gutenberg ?
? What is Gutenberg?
Gutenberg is a name of WordPress Editor, modernize the Writing Experience for WordPress Users. Platforms like Medium, Squarespace, Wix have already changed Writing experience. Classic Editor has given long support 10+ yrs. As this editor looks modern, many users don’t find it useful to them and keep the Classic Editor.
Gutenberg is almost looking like and facilities of Page Builders. It allows Drag and Drop feature, Columns, Grid System, the Content modification is now very much easier than before.
Gutenberg is for those People who love DIY. It will be very easy to create Unique Designed by users himself.
JUST A QUICK NOTE
? I will be Speaking on WordCamp Biratnagar, Nepal
?Released Easy Blocks for Gutenberg Plugin. Ultimate Blocks you’ll need ever
Easy Blocks for Gutenberg ( ? on Github Repo ) is a Zero Configuration Gutenberg Block Editor Plugin. After Activation, We’ve given all necessary resource links Welcome Page. Installation Video Tutorial, Documentation also on Plugin Backend “Essential Blocks" menu.
? Try Easy Blocks for Gutenberg ?
From 6th December 2018 Gutenberg added on WordPress Core. Definitely, it’s a great news for some people at the same time many people aren’t happy with this decision. This is because they aren’t ready for this massive change in Core.
Estimate Number 99.99% website still running on Classic Editor. Established websites will not move at a very early state. Small and Medium websites may suffer from budgets to require changes.
Millions of websites will literally affect at the same time.
Rumors: Not any websites will break if your hosting will not automatically Update Website.
? You’re a Superhero
You’ve got the Power of Controlling your website. You may take any decisions which suit you. You may take any action from giving below:
- Backup your website and Invest Money, Time for your website. Make compatible with Gutenberg. Or,
- Simply, You can Disable Gutenberg until you’re ready for going with Gutenberg
✍Disable Gutenberg Via Code ✍
I will discuss a few ways to disable Gutenberg programmatically. We’ll take a look at those techniques one by one.
? Completely Disable Gutenberg
Gutenberg is an early stage now. Every day new Hooks, Blocks are adding, it’s changing dramatically. Now, you need to place this code on your functions.php file:
add_filter('use_block_editor_for_post', '__return_false');
It will work on Gutenberg v4.1 or later. Tested on WordPress 5.0 beta, it works great.
? Try Easy Blocks for Gutenberg ?
?Disabling Gutenberg for Older Versions
If your WordPress Version is less then 5.0 beta and Gutenberg Version is less than 4.1 then this technique for you.
Older Versions of Gutenberg can be completely disabled by using this small snippet on functions.php file:
add_filter('gutenberg_can_edit_post_type', '__return_false');
Disabling Gutenberg will depend on which Version of WordPress and Gutenberg you’re using. Basically, we did a small trick, call Gutenberg Hook and return to “false".
This technique will disable Gutenberg for all Post Types. If you need to Disable Gutenberg for specific Post Types then follow next:
? Conditional Techniques to Disable Gutenberg
This technique only depends on which Version you’re using ( on our Case we’ll compare WordPress 5.0-beta and Gutenberg Current Version). You may want to disable Gutenberg for specific Versions as well:
We applied simple tricks version_compare() function to check if WordPress Version is 5.0-beta or later. If yes, then we’ve disabled Gutenberg using a filter. Otherwise, we’ve disabled using the latest filter for the Older version of WordPress.
// Disabling Gutenberg 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'); }
? Disabling Gutenberg Plugin for Custom Post Types
We can disable/turn off Gutenberg Plugin for Specific Custom Post Types as well. It's common case Post Types like Teams, Portfolio, Services uses Shortcodes and Custom Fields. In this case, you may not want to enable Gutenberg Plugin.
function jeweltheme_disable_gutenberg($is_enabled, $post_type) { if ($post_type === 'team') return false; // Change "team" to your post type return $is_enabled; } add_filter('use_block_editor_for_post_type', 'jeweltheme_disable_gutenberg', 10, 2);
It's almost similar to the previous method, we've just changed a hook name.
? Disabling Gutenberg Plugin for Custom Post Types - Older Version
We'll follow the similar method as previous. For Older Versions, how to disable the Gutenberg Plugin( Older than v4.1 ) and WordPress Version older than 5.0-beta.
The default behavior of Gutenberg Editor is Active on Post and Pages. By using same filter "gutenberg_can_edit_post_type" other Custom Post Types can be easily disabled.
function jeweltheme_disable_gutenberg($is_enabled, $post_type) { if ($post_type === 'team') return false; // change team to your post type return $is_enabled; } add_filter('gutenberg_can_edit_post_type', 'jeweltheme_disable_gutenberg', 10, 2);
? Disable Gutenberg on Resister Post Type
If you're Plugin/Theme Developer and you don't want to enable Gutenberg Editor for your Post Types. This is the simplest method you can easily achieve your goals, not to Active Gutenberg on Custom Post Types. It will disable the Gutenberg Panel entirely for this custom post type.
To achieve this you need to remove "editor" from "supports" parameter.
$args = array( 'label' => __('Teams'), 'labels' => $labels, 'supports' => array( 'author', 'custom-fields', // 'editor', // <-- Remove this Parameter --> 'title', 'thumbnail' ), 'has_archive' => false, 'hierarchical' => false ); register_post_type('books', $args);
We've excluded "editor" parameter from "Teams" Post Type thus it will not load any scripts related with Gutenberg Plugin.
? Disable Gutenberg on Resister Post Type ( REST API)
We can follow another trick by using REST for Custom Post Types. Just set "show_in_rest" parameter to false.
$args = array( 'label' => __('Teams'), 'labels' => $labels, 'show_in_rest' => false, 'supports' => array( 'author', 'custom-fields', 'editor', 'title', 'thumbnail' ), 'has_archive' => false, 'hierarchical' => false ); register_post_type('books', $args);
It's possible to disable Gutenberg if Editor is supported by Custom Post Types by disabling REST API. Because REST API is required to work on Gutenberg.
? Try Easy Blocks for Gutenberg ?
? Disable Gutenberg for Meta Boxes
Meta Box is so powerful feature in WordPress. A large scale of websites still depending on Meta Boxes. It will need to do extra work for disabling Gutenberg Editor. It can be easily done to disable Meta Boxes on Gutenberg Editor.
__block_editor_compatible_meta_box
Just add this filter on your meta box hook:
add_meta_box( 'metabox_id', 'Metabox Title', 'metabox_callback', null, 'advanced', 'default', array('__block_editor_compatible_meta_box' => false) );
? Change Decision to Enable Gutenberg !!!
After doing lots of stuff, you may change your decision as well. You may suffer few problems to Enable Gutenberg Editor again.
In this case, you will need an extra parameter "priority" on the filter.
add_filter('use_block_editor_for_post', '__return_true', 100 );
We've changed "__return_false" to "__return_true" and added "100" priority. This is because one disable Gutenberg Editor it will not work on same hook and priority. We'll load the hook at last.
? Disclaimer
Gutenberg is changing every day dramatically. Please make sure what you're doing ( Highly suggest to backup your full website ).
If you're happy Gutenberg User then give a Try with our Amazing "Easy Blocks for Gutenberg" Plugin. We're working very hard on this.
Tariqul
Thank you so much! It works for me. I do not like the new editor and much plugins. This is the perfect solution for me.
Liton Arefin
It will take little time to adjust with New Editor. But this is the Future !!!
Lisa George
Awesome tips and step by step explanation on disabling Gutenberg in WordPress. Really appreciate the way you have written and explained.
I am really gonna apply this. Worth reading it.
Thanks for sharing it with us.
Good work..!!
mohsen
thanks i usaed in my website its working