How to disable widget block editor in WordPress 5.8?

How we can disable widget block editor in WordPress 5.8? Moreover, we don’t like it.

Or, we don’t know how to work with it.

Therefore, we want the old system.

The Classic editor.

Why so?

Let us take a look at the widget block editor first.

Gutenberg widget block editor
Gutenberg widget block editor

The problem starts with the beginner. Likewise, we don’t know where to put the widgets.

In the same vein, we need a place to place those widgets.

Either we place widgets in a single page, or in a single post.

That means blog post.

How do I disable the WordPress block editor?

There are several ways to disable the WordPress block editor.

We’ll see them in a minute.

However, we suggest to use a good plugin. Instead of using code in functions.php file.

In functions PHP file we can use the filter.

// Disables the block editor from managing widgets.
add_filter( 'wp_use_widgets_block_editor', '__return_false' );

The “__return_false” function is a default WordPress function. If we add a filter, it returns false.

That means it deactivates that WordPress function.

But, in some cases, it might not work.

Then what to do?

How do I disable Gutenberg editor in WordPress without Plugin?

We’ll look at those options in a minute.

But, before that let’s what plugin we can use.

The best one is Disable Gutenberg. This plugin disables the new Gutenberg Editor.

We also know as Block Editor.

It not only replaces it with the Classic Editor, but also disable Gutenberg completely.

Moreover, we can selectively disable. For example, posts, pages, roles, post types, and theme templates.

Above all, we can hide the Gutenberg nag, menu item, and more!

At the same time, we can use code.

add_filter( 'use_block_editor_for_post', '__return_false' );

Since the filter returns false, it disables Gutenberg.

However, we might not want to disable Block editor completely.

Instead, we can disable a specific post type.

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

Simple, right?

In that case, it returns back the old classic version of widget block editor like the following image.

Classic old version of widget editor
Classic old version of widget editor

To sum up, we can achieve the same functionality two ways.

Either using code, or using plugin.

Now the choice is yours.

What Next?

Books at Leanpub
Books in Apress
My books at Amazon
GitHub repository
Technical blog
Twitter

Comments

Leave a Reply