[wp-trac] [WordPress Trac] #17979: Avoid losing widgets when switching themes

WordPress Trac wp-trac at lists.automattic.com
Mon Aug 1 03:36:04 UTC 2011


#17979: Avoid losing widgets when switching themes
--------------------------+------------------
 Reporter:  lancewillett  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  high          |   Milestone:  3.3
Component:  Widgets       |     Version:  2.9
 Severity:  normal        |  Resolution:
 Keywords:  ux-feedback   |
--------------------------+------------------

Comment (by aaroncampbell):

 The patch attached does most of what was discussed for the basic needs
 here.  It copies widgets across to the new sidebars based on sidebar order
 rather than id, and it only puts things in the inactive widgets if there
 are fewer sidebars in the new theme than the previous.

 The problem is that when the `switch_theme` action is fired we don't
 actually have access to the sidebar list from the new theme.  The simple
 solution would be to include the new theme's functions.php, but the
 problem is that any theme using TEMPLATEPATH or STYLESHEETPATH to include
 things (seems to be pretty common) will be trying to include them from the
 incorrect theme.  Unfortunately fixing #18298 won't fix this until themes
 stop using them.

 Currently the patch attached works if you switch themes and then visit the
 widgets page.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17979#comment:25>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list