Make WordPress Core

Ticket #19291: 19291.1.patch

File 19291.1.patch, 1.4 KB (added by lancewillett, 13 years ago)

Refreshed my patch to remove changes in r19340.

  • wp-includes/widgets.php

     
    11661166
    11671167        $registered_sidebar_keys = array_keys( $wp_registered_sidebars );
    11681168
     1169        $orphaned = 0;
     1170
    11691171        $old_sidebars_widgets = get_theme_mod( 'sidebars_widgets' );
    11701172        if ( is_array( $old_sidebars_widgets ) ) {
    11711173                // time() that sidebars were stored is in $old_sidebars_widgets['time']
    11721174                $_sidebars_widgets = $old_sidebars_widgets['data'];
    11731175                remove_theme_mod( 'sidebars_widgets' );
    1174  
    1175                 $orphaned = 0;
    11761176
    11771177                foreach ( $_sidebars_widgets as $sidebar => $widgets ) {
    11781178                        if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
     
    12341234        unset($_sidebars_widgets, $_widgets);
    12351235
    12361236        // find hidden/lost multi-widget instances
    1237         $lost_widgets = array();
    12381237        foreach ( $wp_registered_widgets as $key => $val ) {
    12391238                if ( in_array($key, $shown_widgets, true) )
    12401239                        continue;
     
    12441243                if ( 2 > (int) $number )
    12451244                        continue;
    12461245
    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 );
    12481248        }
    12491249
    1250         $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']);
    12511250        wp_set_sidebars_widgets($sidebars_widgets);
    12521251
    12531252        return $sidebars_widgets;