From ebb22f1c60a1efd0e24e37413cd86dd1598d5be9 Mon Sep 17 00:00:00 2001 From: Jory Hogeveen Date: Tue, 23 Feb 2021 15:47:32 +0100 Subject: [PATCH] Fix undefined index notices When creating a new widget instance all fields contain a undefined index notice. This fixes this issue because it makes sure the parameters always exist. --- src/Widget.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Widget.php b/src/Widget.php index 7c671b6..d67b392 100644 --- a/src/Widget.php +++ b/src/Widget.php @@ -48,10 +48,7 @@ protected function prepare_instance( $instance ) { 'logged_in_links' => __( "Dashboard | %admin_url%\nProfile | %admin_url%/profile.php\nLogout | %logout_url%", 'sidebar-login' ), 'show_avatar' => '1', ); - if ( empty( $instance ) ) { - $instance = $defaults; - } - return $instance; + return wp_parse_args( $instance, $defaults ); } /**