Opened 6 years ago
Closed 6 years ago
#42719 closed enhancement (fixed)
Always attempt to restore widgets' previous assignment
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9.2 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Widgets | Keywords: | |
Focuses: | ui, administration, template | Cc: |
Description
What I used for testing:
- WordPress 4.9
- no plugins active
- only default WP themes tested
- Browsers used for testing: Firefox v57.0 and Chrome v62.0.3202.94
Steps to reproduce the issue:
- Set the current active theme to "Twenty Seventeen".
- Go to Appearance -> Widgets.
- Assign new or move existing widget(s) to "Footer 1" and "Footer 2" widget areas.
- Active the "Twenty Fifteen" theme.
- Now active the "Twenty Seventeen" theme again.
- Go back to the Appearance -> Widgets page and inspect the theme's widget areas.
Result:
The widgets were not located where they were left last as were assigned prior to switching themes, however in my testing they were consistently either missing from "Footer 1" and "Footer 2" widget areas or moved to the "Blog Sidebar". Some were moved to Inactive Widgets section.
My understanding is that the issues with theme switching and widgets should have been addressed in WP 4.9.
I can replicate this with other themes that have different widget areas.
Attachments (1)
Change History (8)
#2
@
6 years ago
- Milestone changed from Awaiting Review to 4.9.2
- Owner set to obenland
- Status changed from new to accepted
It should. Looks like there is a bug in that logic.
#3
follow-up:
↓ 4
@
6 years ago
After debugging, it's not a bug per se, but more of an unfortunate edge case :)
Switching from 2015 to 2017, widgets from Footer 1
get mapped to 2015's Widget Area
, widgets from Footer 2
are moved into inactive sidebar, since there are no more sidebars to map to.
Switching 2015 back to 2017, Widget Area
widgets get assigned to Blog Sidebar
since both have the same id, sidebar-1
. There are no more active widgets, so the mapping stops at that point and just maintains the inactive sidebar.
I guess what we could do however is to not bail here and always try to restore from previous settings, essentially just giving that logic a chance to retrieve previously active widgets from the inactive side bar. That would still not move widgets back to Footer 1
(rightfully, I'd argue), but it would restore Footer 2
.
Thoughts?
#4
in reply to:
↑ 3
@
6 years ago
Replying to obenland:
I guess what we could do however is to not bail here and always try to restore from previous settings, essentially just giving that logic a chance to retrieve previously active widgets from the inactive side bar. That would still not move widgets back to
Footer 1
(rightfully, I'd argue), but it would restoreFooter 2
.
I think this sounds right to me.
See #39693.
@obenland Aren't the previous theme's widget/sidebar assignments supposed to be restored after switching back?