When adding new widget instance, use isset() to make sure setting key exists and avoid notices/warnings.
This commit is contained in:
parent
eb91907db6
commit
c36369010d
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue