WordPress at Your Fingertips

How to Disable the Gutenberg Block Editor on the Widget page

Since WordPress 5.8, the Gutenberg block editor has been enabled by default for widgets in the admin panel. To disable this editor for widgets, you can use several approaches.

Disabling the block editor for widgets

The codes shown below can be pasted into a plugin or a theme file functions.php.

Option 1

You can use special hook use_widgets_block_editor to turn off block editor on widgets page:

# Disables the block editor for WordPress widgets
add_filter( 'use_widgets_block_editor', '__return_false' );

This hook is more convenient than the second option because it is shorter and can be used anywhere in the code.

Option 2

To disable the block editor, you can also disable the corresponding theme support:

# Disables the block editor for WordPress widgets
add_action( 'after_setup_theme', 'disable_wbe_theme_support' );

function disable_wbe_theme_support() {
	remove_theme_support( 'widgets-block-editor' );
}
No comments
    Log In