Ticket #19092: 19092.2.patch
File 19092.2.patch, 1.7 KB (added by , 13 years ago) |
---|
-
wp-includes/widgets.php
1164 1164 function retrieve_widgets() { 1165 1165 global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets; 1166 1166 1167 $ _sidebars_widgets = array();1168 $sidebars = array_keys($wp_registered_sidebars); 1167 $registered_sidebar_keys = array_keys( $wp_registered_sidebars ); 1168 1169 1169 $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' ); 1170 1170 if ( is_array( $old_sidebars_widgets ) ) { 1171 1171 // time() that sidebars were stored is in $old_sidebars_widgets['time'] 1172 $old_sidebars = $old_sidebars_widgets['data']; 1172 $_sidebars_widgets = $old_sidebars_widgets['data']; 1173 remove_theme_mod( 'sidebars_widgets' ); 1174 1175 $orphaned = 0; 1173 1176 1174 // make sure the saved sidebars match 1175 foreach ( $sidebars as $sidebar_id ) { 1176 $_sidebars_widgets[$sidebar_id] = isset($old_sidebars[$sidebar_id]) ? $old_sidebars[$sidebar_id] : array(); 1177 foreach ( $_sidebars_widgets as $sidebar => $widgets ) { 1178 if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) 1179 continue; 1180 1181 if ( !in_array( $sidebar, $registered_sidebar_keys ) ) { 1182 $_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $widgets; 1183 unset( $_sidebars_widgets[$sidebar] ); 1184 } 1177 1185 } 1178 1179 remove_theme_mod( 'sidebars_widgets' );1180 1186 } else { 1181 1187 if ( empty( $sidebars_widgets ) ) 1182 1188 return; … … 1185 1191 1186 1192 $old = array_keys($sidebars_widgets); 1187 1193 sort($old); 1188 sort($ sidebars);1194 sort($registered_sidebar_keys); 1189 1195 1190 if ( $old == $ sidebars )1196 if ( $old == $registered_sidebar_keys ) 1191 1197 return; 1192 1198 1193 1199 $_sidebars_widgets = array(