Avoid losing widgets when switching themes
|Reported by:||lancewillett||Owned by:||ryan|
Description (last modified by lancewillett)
Symptom: when switching themes all widgets are moved to "Inactive Widgets" area, leaving an empty sidebar.
This happens when:
- New theme has a different number of registered sidebars than old theme.
- New theme and old theme have the same number of registered sidebars, but the ID value for the sidebar is different between the two.
Widgets should never be put into Inactive if the new theme has a least one sidebar registered. The ID values for registered sidebars in themes should be ignored and not used for comparison.
Here are three files that contain the important pieces:
- switch_theme() in wp-includes/theme.php
- retrieve_widgets() in wp-admin/widgets.php
- wp_get_sidebars_widgets() in wp-includes/widgets.php
Change History (146)
- Keywords 3.3-early added; dev-feedback removed
- Milestone changed from Awaiting Review to Future Release
- Priority changed from normal to high
- Severity changed from major to normal
- Type changed from defect (bug) to enhancement
- Version changed from 3.2 to 2.9