function bsa_function_views_stats() { $model = new BSA_PRO_Model(); $get_views_counter = get_option('bsa_pro_plugin_dashboard_views'); $get_daily_counter = $model->getDailyViews(time() - 30 * 60); if ($get_daily_counter[0] > 0) { update_option('bsa_pro_plugin_dashboard_views', $get_views_counter + $get_daily_counter[0]); // increase views stats } wp_schedule_single_event(time() + 30 * 60, 'bsa_cron_views_stats', array(time())); }