Ticket #19291: 19291.1.patch
File 19291.1.patch, 1.4 KB (added by , 13 years ago) |
---|
-
wp-includes/widgets.php
1166 1166 1167 1167 $registered_sidebar_keys = array_keys( $wp_registered_sidebars ); 1168 1168 1169 $orphaned = 0; 1170 1169 1171 $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); 1170 1172 if ( is_array( $old_sidebars_widgets ) ) { 1171 1173 // time() that sidebars were stored is in $old_sidebars_widgets['time'] 1172 1174 $_sidebars_widgets = $old_sidebars_widgets['data']; 1173 1175 remove_theme_mod( 'sidebars_widgets' ); 1174 1175 $orphaned = 0;1176 1176 1177 1177 foreach ( $_sidebars_widgets as $sidebar => $widgets ) { 1178 1178 if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) … … 1234 1234 unset($_sidebars_widgets, $_widgets); 1235 1235 1236 1236 // find hidden/lost multi-widget instances 1237 $lost_widgets = array();1238 1237 foreach ( $wp_registered_widgets as $key => $val ) { 1239 1238 if ( in_array($key, $shown_widgets, true) ) 1240 1239 continue; … … 1244 1243 if ( 2 > (int) $number ) 1245 1244 continue; 1246 1245 1247 $lost_widgets[] = $key; 1246 // Any lost widgets from previous sidebars become orphans, one widget per orphan area. 1247 $sidebars_widgets['orphaned_widgets_' . ++$orphaned] = array( $key ); 1248 1248 } 1249 1249 1250 $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']);1251 1250 wp_set_sidebars_widgets($sidebars_widgets); 1252 1251 1253 1252 return $sidebars_widgets;