Description
Allows the frequency of the cron job that calculates poll data to be modified. The default schedule is set to hourly to avoid heavy loads on the server.
The wp_cron job will take over the calculation of the results if 5 seconds is not long enough at the time of form submission/update.
Important: the Polls Add-On must be deactivated and reactivated in order to reschedule the task.
Usage
add_filter( 'gform_polls_cron_schedule', 'your_function_name', 10, 1 );
Parameters
- $schedules array
An array of the current schedules.
Examples
add_filter( 'gform_polls_cron_schedule', 'gform_polls_cron_add_twice_hourly' ); function gform_polls_cron_add_twice_hourly( $schedules ) { // Adds twice hourly to the existing schedules. $schedules['twicehourly'] = array( 'interval' => 1800, // number of seconds in the interval 'display' => 'Twice Hourly' ); return $schedules; }
Placement
This code should be placed in the functions.php file of your active theme.
Since
This filter was added in the Gravity Forms Polls Add-On version 1.5.
Source Code
This filter is located in GFPolls::get_custom_cron_schedule() in class-gf-polls.php