Not everyone loved the WordPress 5.8 update that brought a feature called widget blocks, and many people wanted to turn it off. While it worked with all the old widgets, which calmed a lot of website owners down, it was undoubtedly hard to change a habit or an established workflow. Let’s just say that the fact you may use blocks within the widget area, which used to be a simple text area, is a noticeable change. We don’t judge users who disliked it. Instead, we sincerely want to help them because the procedure is straightforward. With that said, here’s how to disable widget blocks in WordPress
1. Disable widget blocks in WordPress through a code snippet
As usual, we’re starting with a process that is light on your server resources, yet beginner-friendly and concise. You can add all these codes to functions.php of your active theme, preferably the child one. You’ll find all the instructions in our guide on editing a theme in WordPress. If you’re iffy about making changes directly, you can also employ a code snippet plugin for PHP or create a site-specific WordPress plugin. There are a few distinct functions you can use. First, this function will turn off the Gutenberg Editor in widgets, but your pages and posts will retain the block editor functionality:
function example_theme_support() {
remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'example_theme_support' );
Alternatively, you can forbid Gutenberg from having control of widgets this way:
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false', 100 );
WordPress in its official handbook recommends using this line of code that does the same:
add_filter( 'use_widgets_block_editor', '__return_false' );
If you have a writer, editor, or administrator that still wants to use widget blocks, WordPress provided this function you can modify after getting the current user ID. This will disable it for everyone else but that user.
function example_use_widgets_block_editor( $use_widgets_block_editor ) {
if ( 123 === get_current_user_id() ) {
return false;
}
return $use_widgets_block_editor;
}
add_filter( 'use_widgets_block_editor', 'example_use_widgets_block_editor' );
2. Configure your theme to deny support for widgets (Advanced)
Are you a theme developer or have fired one to create your theme? You can/let them know to add this function into the configuration or theme setup file:
function disable_wpthinker_theme_support() {
remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'disable_wpthinker_theme_support' );
When you activate that theme, widgets will use the classic mode of editing, as it will decline Gutenberg from managing widgets. You can switch the “wpthinker” part of the function—this is merely an example.
3. Restore Classic widgets by installing a WordPress plugin
Unsurprisingly, WordPress plugin installation can solve problems in a beginner-friendly way. This time your server resources won’t be noticeably affected, which is a plugin With that said, we suggest using one of two plugins from the WordPress repository:
- Classic Widgets by WordPress Contributors. The simplest, direct solution to the problem, supported by a team of developers who love Classic Editor. No extra steps after activating are necessary, and you can be sure it will remain up-to-date.
- Disable Gutenberg by Jeff Star. A more radical approach that can disable all or some functions of Gutenberg Editor. After activation, you must head to the WordPress Admin, and click Settings → Disable Gutenberg in the left sidebar. Put a checkmark to the right of Classic Widgets or Complete Disable to turn off Gutenberg entirely.