Avoid losing widgets when switching themes
|Reported by:||lancewillett||Owned by:||ryan|
|Cc:||ocean90, westi, aaroncampbell, info@…, Ken@…, andrewryno@…, sabreuse@…, sbressler@…, nerrad, Brian@…, hanni, gaarai@…, pauldewouters, ipstenu@…, ryan@…, jeremy@…, meglio|
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 (145)
- 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
comment:13 scribu — 2 years ago
- Keywords 3.3-early removed
- Milestone changed from Future Release to 3.3
comment:57 follow-up: ↓ 58 ocean90 — 2 years ago
comment:80 in reply to: ↑ 74 azaozz — 2 years ago
comment:106 ryan — 2 years ago
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed