[wp-trac] [WordPress Trac] #39693: Fix missing assignment of widgets on theme switch

WordPress Trac noreply at wordpress.org
Wed Sep 6 14:35:47 UTC 2017


#39693: Fix missing assignment of widgets on theme switch
--------------------------------------+--------------------------
 Reporter:  melchoyce                 |       Owner:  westonruter
     Type:  enhancement               |      Status:  reviewing
 Priority:  normal                    |   Milestone:  4.9
Component:  Widgets                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+--------------------------

Comment (by obenland):

 > I was testing with a theme that had sidebars sidebar-1 and sidebar-2 and
 then another theme that had sidebars primary and footer. I was expecting
 when switching that they would get mapped correspondingly, but they were
 not. So I included sidebar-1 and sidebar-2 in the primary and footer
 groups respectively.

 That kind of expectation would probably be good to cover in a unit test.
 FWIW, the addition of `sidebar-1` should be redundant because we're
 looking for `*sidebar*` with the next slug.

 > The lost widgets logic appears to be blowing a way old single widgets
 that lack widget numbers. I think that logic could probably be removed?

 Good catch! Unfortunately the link doesn't seem to work?

 > I was working on scenarios for testing the various sidebar theme
 permutations, and I found a scenario where from a theme with 3 populated
 sidebars to a theme with 2 sidebars and then switching back to the theme
 with 3 sidebars results in the one sidebar that was not initially mapped
 being empty after having switched back. This seems bad to me. I think this
 is part of the orphaned sidebar question.

 What we could do is to check wp_inactive_widgets for the ids in that third
 sidebar. Overall however I think the expectation that they map right back
 to where they were is only reasonable for immediate switch backs, yes?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39693#comment:91>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list