| 1 | Index: wp-includes/widgets.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/widgets.php (revision 11157) |
|---|
| 4 | +++ wp-includes/widgets.php (working copy) |
|---|
| 5 | @@ -1034,6 +1034,7 @@ |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | if ( $single ) { |
|---|
| 9 | + $found = false; |
|---|
| 10 | $settings = array( 2 => $settings ); |
|---|
| 11 | |
|---|
| 12 | // If loading from the front page, update sidebar in memory but don't save to options |
|---|
| 13 | @@ -1046,16 +1047,24 @@ |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | foreach ( (array) $sidebars_widgets as $index => $sidebar ) { |
|---|
| 17 | + if ( $index == 'wp_inactive_widgets' ) |
|---|
| 18 | + continue; |
|---|
| 19 | + |
|---|
| 20 | if ( is_array($sidebar) ) { |
|---|
| 21 | foreach ( $sidebar as $i => $name ) { |
|---|
| 22 | if ( $base_name == $name ) { |
|---|
| 23 | $sidebars_widgets[$index][$i] = "$name-2"; |
|---|
| 24 | + $found = true; |
|---|
| 25 | break 2; |
|---|
| 26 | } |
|---|
| 27 | } |
|---|
| 28 | } |
|---|
| 29 | } |
|---|
| 30 | - |
|---|
| 31 | + |
|---|
| 32 | + // don't register unfound, single widgets |
|---|
| 33 | + if ( !$found ) |
|---|
| 34 | + $settings = array(); |
|---|
| 35 | + |
|---|
| 36 | if ( is_admin() ) |
|---|
| 37 | update_option('sidebars_widgets', $sidebars_widgets); |
|---|
| 38 | } |
|---|