Since WordPress 5.8, Appearance → Widgets and the Customizer’s widget panel use the block editor. If your theme, your widget code or your clients rely on classic widgets, you can restore classic widgets in WordPress without a plugin. It takes one filter, the same one the official Classic Widgets plugin adds.
This is useful on classic themes with sidebars and footer widget areas, where the block-based screen is slower to load and makes simple widgets like a menu or a text box harder to manage.
The snippet
<?php
/**
* Classic widgets in Appearance → Widgets and the Customizer.
*/
add_filter( 'use_widgets_block_editor', '__return_false', 100 );
How it works
wp_use_widgets_block_editor()decides which widget editor WordPress loads. It starts from the theme’swidgets-block-editorsupport and passes the result through theuse_widgets_block_editorfilter. Returningfalseloads the classic screens in Appearance → Widgets and in the Customizer.- The older One-Click Import version also filtered
gutenberg_use_widgets_block_editor. That name only mattered for the Gutenberg plugin before the feature moved into core; current Gutenberg uses the core filter, so the line is gone. - Priority
100beats a theme or plugin that turns the block editor back on at the default priority. - The filter changes nothing that is stored. Your sidebars, widgets and their settings stay as they are; only the editing screen changes.
Add it with Scripts Organizer
In Scripts Organizer go to Code Blocks → Add New and give the block a name. Set Trigger location to Everywhere, tick PHP under Script location, paste the code into the PHP editor and publish. Leave Action/Hook empty. Admin only would cover Appearance → Widgets, but the Customizer’s preview frame is a front-end request, so Everywhere is the choice that keeps both editors in the same mode. The cost is one add_filter() call per request.
The same code also works unchanged in a small plugin or an mu-plugin.
Customise it
- Only for one theme: hook a function instead of
__return_falseand return'my-theme' !== get_stylesheet(), so the block editor stays on for other themes. - Keep it for administrators only: return
! current_user_can( 'manage_options' )from that function, so other roles get classic widgets and admins keep blocks.
Once the classic screen is back, these work with classic widgets: Remove Widget Title Conditionally and Widget Title change h2 to h4.
Gotchas
- Widgets you already built as blocks don’t disappear. The classic screen lists each one as a “Block” widget with its block markup in a text field; edit or replace them there.
- Block themes have no widget areas, so there is nothing to restore. The snippet only matters for themes that register sidebars.
- The post and page editor is not affected. Switching that off is a different filter,
use_block_editor_for_post.
In the Scripts Organizer library Import it with one click from Scripts Organizer.