[wp-trac] [WordPress Trac] #33180: Widgets not preserved after switching theme and deactivate plugins

WordPress Trac noreply at wordpress.org
Wed Jul 29 22:09:18 UTC 2015


#33180: Widgets not preserved after switching theme and deactivate plugins
--------------------------+------------------------------
 Reporter:  pavelevap     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Widgets       |     Version:  2.8
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by westonruter):

 * version:  trunk => 2.8


Comment:

 This is expected behavior, though it certainly isn't desireable. See
 `retrieve_widgets()` where when it builds the list of widgets to apply to
 the newly switched-to theme, it only includes widget instances that are
 currently registered:

 {{{#!php
                 foreach ( $widgets as $widget ) {
                         if ( isset($wp_registered_widgets[$widget]) )
                                 $_widgets[] = $widget;
                 }
 }}}

 So if the plugin that registers a widget is deactivated when the theme is
 switched, then it will be stripped from the sidebar. However, note that a
 deactivated widget will also be removed from a sidebar when you reorder
 the widgets in a sidebar, since the `sidebars_widgets` setting will be
 updated to whatever widget IDs are present in the current view (thus
 excluding widgets that are not registered).

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


More information about the wp-trac mailing list