Fix WordPress Widget Error: Block Was Affected by Errors

Quick Summary
- Switching back to the classic widgets screen clears the affected-by-errors warning that block-based widgets can show in some themes since WordPress 5.8.
- Installing and activating the Classic Widgets plugin restores the old screen without code, and deactivating it brings block widgets back.
- Without a plugin, filter use_widgets_block_editor with __return_false in a child theme's functions.php to revert Widgets and the Customizer.
Since WordPress 5.8, widgets are edited with the block editor. Some themes and older widgets don’t work well with it, and you may see the message “This block was affected by errors and may not function properly” when you edit your widgets. The quickest fix is to switch back to the classic widgets screen. There are two ways to do that; you only need one of them.
Solution 1: use a plugin to stop the “block was affected by errors” message
Install and activate the Classic Widgets plugin. It restores the previous widgets screen without any code, and you can go back to block widgets by deactivating it.
Solution 2: disable the block widget editor with code
If you’d rather not add a plugin, add this code to your active theme’s functions.php file. Use a child theme, or the change is lost when the theme updates.
//fix error for widget
add_filter( 'use_widgets_block_editor', '__return_false' );The use_widgets_block_editor filter decides whether WordPress uses the block-based widget editor. Returning false through the core helper __return_false switches both Appearance > Widgets and the widget panels in the Customizer back to the classic interface. For more on how filters like this one work, see WordPress action and filter hooks explained.
Related articles
- keeping functions.php organized: a tidy home for small fixes like this filter
- get_stylesheet_directory() vs get_template_directory(): which theme your file paths point to once code lives in a child theme

