get_results( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE 'agile_chunk_data_%'", ARRAY_A ); // $cutoff_time = time() - (24 * 60 * 60); // 24 hours ago foreach ( $chunk_options as $option ) { $option_name = $option['option_name']; if ( preg_match( '/agile_chunk_data_(\d+)$/', $option_name, $matches ) ) { $timestamp = (int) $matches[1]; // Delete if older than 24 hours // if ($timestamp < $cutoff_time) { delete_option( $option_name ); // } } } } static function clear_scheduled_actions() { // Check if Action Scheduler is available agile_tix_unschedule_all_actions( '', array(), 'agile_events_processing' ); if ( function_exists( 'as_get_scheduled_actions' ) && class_exists( 'ActionScheduler_Store' ) ) { $all_statuses = array( ActionScheduler_Store::STATUS_COMPLETE, ActionScheduler_Store::STATUS_FAILED, ActionScheduler_Store::STATUS_CANCELED, ); foreach ( $all_statuses as $status ) { $actions = as_get_scheduled_actions( array( 'group' => 'agile_events_processing', 'status' => $status, 'per_page' => -1, // Get all ) ); } } } }