WordPress widgets are self-contained pieces of content, such as a search box, a list of recent posts or a block of text, that you place in a widget area your theme registers, usually a sidebar or a footer. In a classic theme you manage them at Appearance, Widgets; in a block theme such as Twenty Twenty-Five that screen does not exist, and the same job is done by template parts in Appearance, Editor.
That second sentence is where most of the confusion comes from. The rest of this post explains why the screen disappears, where widgets are actually stored, and what WordPress does with them when you change theme, because that is the moment people lose them.
What are widgets in WordPress?
A widget is an instance of a widget type placed in a widget area. Plugins can register more types on top of core's.
On a default WordPress 7.1.5 install, core registers eighteen widget types, including Search, Recent Posts, Categories, Archives, Custom HTML, Image, Navigation Menu, RSS and Block (a nineteenth, Links, appears only if the old link manager is enabled).
A widget area only exists because the theme calls register_sidebar(). Despite the name, a "sidebar" can be a footer column, a header strip or anything else the theme prints with dynamic_sidebar().
The difference from a plugin is scope: a plugin adds behaviour to the whole site.
A widget is one placed box of content, and it only appears where the theme has made room for it.
Where are widgets in WordPress?
It depends on the theme type, and you can tell from the admin menu.
- Classic theme: Appearance, Widgets, or the Widgets panel in Appearance, Customize.
- Block theme: there is no Widgets item. Use Appearance, Editor, open a template part such as the footer, and add blocks there.
The menu item is not a setting.
In core, register_sidebar() ends by calling add_theme_support( 'widgets' ), and wp_widgets_add_menu() only adds Widgets to the Appearance menu when the theme supports it.
Block themes register no widget areas, so the screen never appears, and loading wp-admin/widgets.php directly stops with an error for the same reason.
Twenty Twenty-Five ships parts/sidebar.html, parts/footer.html and parts/footer-columns.html, the block equivalent of widget areas.
They hold blocks saved in a template part instead of widgets saved in a sidebar. We covered how those edits are stored in the footer post.
Why does the Widgets screen look like the block editor?
Since WordPress 5.8, the classic Widgets screen is a block editor. Each block you add is saved as a widget of type block, so a Paragraph or Image block sits in your sidebar next to any older widgets.
Older widgets that have no block version still work. They appear inside a Legacy Widget block with their original settings form.
If you want the old drag-and-drop screen back, there are two ways, and the Classic Widgets plugin does it with no code.
Its wordpress.org page (read 2026-11-22) lists 2+ million active installations and version 0.3, but it is tested only up to 6.9.12, and its description still says it "will be supported and maintained to 2024, or as long as is necessary."
The plugin is a thin wrapper around a core filter, so you can skip it. Put this in a small must-use plugin:
<?php
// wp-content/mu-plugins/classic-widgets.php
add_filter( 'use_widgets_block_editor', '__return_false' );
Core decides with apply_filters( 'use_widgets_block_editor', get_theme_support( 'widgets-block-editor' ) ), so a theme can also opt out with remove_theme_support( 'widgets-block-editor' ).
Where are widgets stored?
Two kinds of options in wp_options hold everything:
sidebars_widgetsis the map of which widget IDs sit in which area, pluswp_inactive_widgets.widget_{type}holds each instance's settings:widget_blockfor block widgets,widget_text,widget_search,widget_recent-postsand so on for the rest.
A widget ID is the type plus a number, so block-3 is the third entry in widget_block. This split matters later: a widget can lose its place in sidebars_widgets while its settings stay intact in its own option.
With SSH and WP-CLI you can read both without opening the admin:
wp sidebar list --fields=id,name
wp widget list sidebar-1 --fields=id,position
wp option get sidebars_widgets --format=json
The last command is the one to save before any theme change. Its output looks like {"wp_inactive_widgets":[],"sidebar-1":["block-2","block-3"],"array_version":3}, and it is the whole widget layout in one line.
What happens to widgets when you switch theme?
The short version every guide gives is "they move to Inactive Widgets", which is sometimes true.
What actually happens is a mapping step in wp-includes/widgets.php, and it is worth knowing because it decides which widgets land where.
When you switch, switch_theme() first saves the current layout into the old theme's theme mods as sidebars_widgets, with a timestamp. On the next page load, the after_switch_theme action runs retrieve_widgets( true ), which calls wp_map_sidebars_widgets() and writes the result back to the database.
The mapping goes in this order:
- If the old and new theme each have exactly one widget area, everything moves across.
- Areas with the same ID keep their widgets.
sidebar-1tosidebar-1is a perfect match. - Anything left is matched by name, using four hard-coded groups:
sidebar,primary,main,right; thensecond,left; thensidebar-2,footer,bottom; thenheader,top. An area calledfooter-widgetsin one theme can receive the widgets frombottom-barin another. - Whatever still has no home goes to Inactive Widgets, settings intact.
- If the new theme was active before, its own saved layout is restored on top, so switching back to a theme you used last month brings its old arrangement back.
That fourth step is the "they move to Inactive Widgets" case. The third step is the one that surprises people, because it can put a footer's widgets in a new theme's bottom strip without asking, and it is a guess based on substrings in IDs.
The widgets that do not survive
Before mapping, retrieve_widgets() passes the layout through _wp_remove_unregistered_widgets(). Any widget whose type is not registered at that moment is taken out of its area.
In practice that means a widget from a plugin that is deactivated during the switch, for example a social feed widget, is dropped from sidebars_widgets and saved that way. It does not go to Inactive Widgets, because WordPress no longer knows what it is.
The settings stay in the plugin's widget_* option, so the data is not gone. Getting it back means reactivating the plugin and re-placing the widget by hand, or restoring the sidebars_widgets value you saved earlier.
None of the four guides we read for this post (Hostinger, IONOS, Bluehost and the theme handbook page, all read 2026-11-22) mention the name-matching groups or this case.
What happens when you switch from a classic theme to a block theme?
Since WordPress 6.2, the move to a block theme keeps your widgets. switch_theme() stores the classic theme's registered widget areas in the block theme's theme mods as wp_classic_sidebars, and on every load _wp_block_theme_register_classic_sidebars() registers them again.
It does that without calling register_sidebar(), on purpose, so widget support is not switched on. The source comment says so: "Don't use register_sidebar since it will enable the widgets support for a theme."
The result is a state that looks like data loss and is not. Your widgets are still in sidebars_widgets, but no template prints them and there is no Widgets screen to see them on.
To bring them into the block theme:
- Open Appearance, Editor and edit the template you want them in.
- Insert a Template Part block and start a new, empty one.
- In the block's Advanced settings, choose the old area under Import widget area and press Import.
Core creates a template part named "Widget area: Sidebar" (or whatever the area was called).
Block widgets come back as normal blocks; classic widgets come back as Legacy Widget blocks.
Any widget it cannot convert is listed in a notice, "Unable to import the following widgets", so read that before you delete anything.
The import control only appears on a template part with no blocks in it, and only lists areas that still contain widgets. If you emptied the old areas first, there is nothing to import.
How do you add a widget?
For completeness, since this is the part every guide covers well:
- Classic theme: Appearance, Widgets, click the + inside the area you want, pick a block or a legacy widget, then Update.
- Customizer: Appearance, Customize, Widgets, which shows a live preview as you edit.
- Block theme: Appearance, Editor, open the template part, and insert blocks. The Latest Posts, Search, Categories and Archives blocks replace the old widgets of the same names.
If a theme has no area where you want the widget, a theme developer adds one with register_sidebar() and prints it with dynamic_sidebar() in a template. That is a theme change, so do it in a child theme.
Test the theme switch before you do it on the live site
Adding a widget is safe to do live. Switching theme is not, and the widget mapping is only one reason.
We wrote up the rest, from page templates to shortcodes, in how to test a theme switch.
The honest problem with testing widgets on a fresh install is that a fresh install has no widgets. The mapping depends on your real area IDs, your real plugin widgets and your previous theme's saved layout, and none of that exists on a blank site.
So do it on a copy:
- Clone the live site into a sandbox with the SandyWP Cloner. It reads production and copies the database, themes, plugins and media; it never writes to the live site.
- On the copy, save the layout:
wp option get sidebars_widgets --format=json > before.json. - Switch theme, load any page once so
after_switch_themeruns, and save it again asafter.json. - Compare the two. Look for widgets that moved to an unexpected area, landed in
wp_inactive_widgets, or vanished entirely.
If you are building a theme, run the same check with your theme as the target, from the themes your customers are likely to arrive from. Our page for theme developers covers the rest of that workflow.
When the copy looks right, do the switch on live knowing exactly which areas need attention. When it does not, you found out on a site you can delete.
