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

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 26 23:49:13 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 has-patch needs-testing  |
-------------------------------------------------+------------------

Comment (by aaroncampbell):

 Ok, so I can pass data from the old theme to the new by storing a string
 like "{themename} - old-sidebar-id" as the ID for the new sidebar.
 Unfortunately, the use of sanitize_title() in dynamic_sidebar() prevents
 you from using an ID that is not already sanitized (even though with the
 way we store them there's really no need for that).  However, this patch
 ([attachment:17979.8.diff]) works around that by making the name match the
 id, which causes dynamic_sidebar() to not pass the id through
 sanitize_title().  I'm honestly not super happy with it because it's kind
 of hacky, but it works and lets the user know why this new widget
 container is there.  The hack wouldn't be necessary if we removes the
 sanitize_title() from dynamic_sidebar() but I don't know what that would
 break.  It looks like it's been there for 4 years [5301].

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


More information about the wp-trac mailing list