diff --git a/wp-admin/widgets.php b/wp-admin/widgets.php index 4ead317a74..fc5942115d 100644 --- a/wp-admin/widgets.php +++ b/wp-admin/widgets.php @@ -252,13 +252,15 @@ if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {

- $sbvalue ) { + $sbvalue ) { echo "\t\t
"; if ( 'wp_inactive_widgets' == $sbname ) { echo ' '; } else { if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) { $j = 1; + $sidebars_widgets[$sbname] = array(); } else { $j = count($sidebars_widgets[$sbname]); if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) diff --git a/wp-includes/widgets.php b/wp-includes/widgets.php index 2f0280d7ad..f49a3fdee0 100644 --- a/wp-includes/widgets.php +++ b/wp-includes/widgets.php @@ -970,7 +970,7 @@ function wp_get_sidebars_widgets($deprecated = true) { $sidebars_widgets = get_option('sidebars_widgets', array()); $_sidebars_widgets = array(); - if ( isset($sidebars_widgets['wp_inactive_widgets']) ) + if ( isset($sidebars_widgets['wp_inactive_widgets']) || empty($sidebars_widgets) ) $sidebars_widgets['array_version'] = 3; elseif ( !isset($sidebars_widgets['array_version']) ) $sidebars_widgets['array_version'] = 1;