Description
Gravity Forms includes a filter for controlling the cron interval of background processing classes that extend the GF_Background_Process class. The {$this->identifier}_cron_interval
filter allows developers to override the default schedule for asynchronous tasks, such as processing feeds or handling notifications.
This filter is dynamically generated based on the identifier property of the background process class. The identifier is constructed by combining the class’s $prefix and $action properties.
Identifiers
Class | Filter Name | Default Value |
---|---|---|
GF_Feed_Processor | wp_gf_feed_processor_cron_interval | 5 minutes |
GF_Background_Upgrader | wp_gf_upgrader_cron_interval | 5 minutes |
GF_Notifications_Processor | wp_gf_notifications_processor_cron_interval | 5 minutes |
GF_Telemetry_Processor | wp_gf_telemetry_processor_cron_interval | 5 minutes |
Usage
add_filter( 'wp_gf_feed_processor_cron_interval', function( $interval ) {
return 10 * MINUTE_IN_SECONDS; // Set interval to 10 minutes
} );
Parameters
Parameter | Type | Description |
---|---|---|
$interval | integer | The interval in seconds between scheduled executions. Default is 5 * MINUTE_IN_SECONDS unless overridden by the class property $cron_interval . |
Default Behavior
Each subclass of GF_Background_Process can define its default interval by setting the $cron_interval property. If this property is not set, the fallback default is 5 minutes.