From c36369010de65bb2439cc10cdc8c489880645e48 Mon Sep 17 00:00:00 2001 From: Scott Basgaard Date: Wed, 13 Nov 2013 21:03:46 -0500 Subject: [PATCH] When adding new widget instance, use isset() to make sure setting key exists and avoid notices/warnings. --- includes/abstracts/abstract-wc-widget.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/abstracts/abstract-wc-widget.php b/includes/abstracts/abstract-wc-widget.php index a56844d4828..72e701d9311 100644 --- a/includes/abstracts/abstract-wc-widget.php +++ b/includes/abstracts/abstract-wc-widget.php @@ -82,7 +82,8 @@ abstract class WC_Widget extends WP_Widget { return $instance; foreach ( $this->settings as $key => $setting ) { - $instance[ $key ] = sanitize_text_field( $new_instance[ $key ] ); + if ( isset( $new_instance[$key] ) ) + $instance[ $key ] = sanitize_text_field( $new_instance[ $key ] ); } $this->flush_widget_cache();