use_widgets_block_editor

Home » Hooks » use_widgets_block_editor

The WordPress hook use_widgets_block_editor is a filter hook used to determine whether the Block Editor should be used for managing widgets in the WordPress admin area.

By default, the Block Editor is enabled for managing widgets starting from WordPress version 5.8. However, this hook allows developers to override this behavior and disable the Block Editor for widgets, reverting back to the classic widget management interface.

This hook can be useful in situations where site owners or developers prefer to stick with the familiar interface of the classic widget management system, or if there are compatibility issues with certain themes or plugins when using the Block Editor for widgets.

To use the use_widgets_block_editor hook, you can add the following code to your theme’s functions.php file or a custom plugin:

function disable_widgets_block_editor( $use_widgets_block_editor ) {
    return false; // Disable the Block Editor for widgets
}
add_filter( 'use_widgets_block_editor', 'disable_widgets_block_editor' );

In this example, the disable_widgets_block_editor function is hooked into the use_widgets_block_editor filter. It simply returns false, indicating that the Block Editor should be disabled for widgets.

Learn More on WordPress.org

WordPress snippets using the use_widgets_block_editor hook

Register an account to save your snippets or go Pro to get more features.