From 32b78337cf4cdc9b956a0594e9869c8d8d4484ba Mon Sep 17 00:00:00 2001 From: Shady Sharaf Date: Mon, 9 Dec 2013 01:21:41 +0200 Subject: [PATCH] Fix warning on activating new themes. Fixes #48 --- connectors/menus.php | 4 ++++ connectors/widgets.php | 3 +++ 2 files changed, 7 insertions(+) diff --git a/connectors/menus.php b/connectors/menus.php index 4735ba754..0ebad35f6 100644 --- a/connectors/menus.php +++ b/connectors/menus.php @@ -129,6 +129,10 @@ public static function callback_delete_nav_menu( $term, $tt_id, $deleted_term ) public static function callback_update_option_theme_mods( $old, $new ) { $key = 'nav_menu_locations'; + if ( ! isset( $new[$key] ) ) { + return; // Switching themes ? + } + if ( $old[$key] === $new[$key] ) { return; } diff --git a/connectors/widgets.php b/connectors/widgets.php index 0f276490b..9433e0e0f 100644 --- a/connectors/widgets.php +++ b/connectors/widgets.php @@ -105,6 +105,9 @@ public static function callback_update_option_sidebars_widgets( $old, $new ) { if ( ! $widget_id ) { foreach ( $new as $sidebar_id => $new_widgets ){ + if ( ! is_array( $old[$sidebar_id] ) || ! is_array( $new_widgets ) ) { + return; // Switching themes ? + } $old_widgets = $old[$sidebar_id]; // Added ?