From a34db48a4ba27eeb04f797fda054255de66f8e58 Mon Sep 17 00:00:00 2001 From: ekes Date: Fri, 12 Nov 2021 15:50:26 +0100 Subject: [PATCH] Fix empty array warning, correct syntax for cron timing storage. --- includes/squat-radar-widget.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/squat-radar-widget.php b/includes/squat-radar-widget.php index c058824..f4a6eef 100644 --- a/includes/squat-radar-widget.php +++ b/includes/squat-radar-widget.php @@ -66,7 +66,7 @@ class Squat_Radar_Widget extends WP_Widget { } } } - set_option('squat_radar_widget_cron_run', $last_run); + add_option('squat_radar_widget_cron_run', $last_run); } /** @@ -75,9 +75,9 @@ class Squat_Radar_Widget extends WP_Widget { protected static function cache_refresh($instance) { $connector = new Squat_Radar_Connector(); - $languages = apply_filters( 'wpml_active_languages', NULL); - $languages = array_keys($languages); - $languages = array_merge($instance['url']['keys']['language'], (array) $languages); + $languages = apply_filters('wpml_active_languages', NULL); + $languages = is_array($languages) ? array_keys($languages) : []; + $languages = array_merge($instance['url']['keys']['language'], $languages); foreach ($languages as $language) { try { // Force update. Don't set expire.