Widgets: Don't try mapping empty sidebars.
Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings. Props ionvv, chetan200891 for initial patch. Fixes #42603. Built from https://develop.svn.wordpress.org/trunk@42362 git-svn-id: http://core.svn.wordpress.org/trunk@42191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4048a63b01
commit
ff25787995
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42361';
|
$wp_version = '5.0-alpha-42362';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
|
@ -1333,6 +1333,9 @@ function wp_map_sidebars_widgets( $existing_sidebars_widgets ) {
|
||||||
|
|
||||||
if ( is_array( $old_sidebars_widgets ) ) {
|
if ( is_array( $old_sidebars_widgets ) ) {
|
||||||
|
|
||||||
|
// Remove empty sidebars, no need to map those.
|
||||||
|
$old_sidebars_widgets = array_filter( $old_sidebars_widgets );
|
||||||
|
|
||||||
// Only check sidebars that are empty or have not been mapped to yet.
|
// Only check sidebars that are empty or have not been mapped to yet.
|
||||||
foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) {
|
foreach ( $new_sidebars_widgets as $new_sidebar => $new_widgets ) {
|
||||||
if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) {
|
if ( array_key_exists( $new_sidebar, $old_sidebars_widgets ) && ! empty( $new_widgets ) ) {
|
||||||
|
|
Loading…
Reference in New Issue