Description
The gravityflow_step_due_date_timestamp filter allows the due_date timestamp to be overridden.
Parameters
| Parameter | Type | Details |
|---|---|---|
| $due_date_timestamp | Integer | The current scheduled due date (UTC) |
| $expiration_type | String | The type of expiration defined in step settings. |
| $t | Step | The current step. |
Examples
Adjust due date based on a field value
This example increases the due date by a day for a specific form with a specific value on one of the entries.
add_filter( 'gravityflow_step_due_date_timestamp', 'extend_expiration_date', 10, 3 );
function extend_expiration_date( $due_date_timestamp, $expiration_type, $step ) {
//Ensure you are only adjusting the desired form/step
if ( $step->get_id() !== 76 ) {
return $due_date_timestamp;
}
$entry = $step->get_entry();
if ( $entry && isset( $entry['2'] ) && $entry['2'] == 'Extended' ) {
$due_date_timestamp = strtotime('+1 day', $due_date_timestamp );
}
return $due_date_timestamp;
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
How Gravity Flow Handles Scheduled Events
Gravity Flow uses WordPress’s WP-Cron system to schedule time-based tasks, including the gravityflow_cron event, which runs every 15 minutes to process queued workflow steps.
Note: Since WP-Cron relies on site visits to trigger scheduled events, tasks may be delayed during periods of low traffic. For example, if a workflow step is due at 4:00 AM but no one visits the site until 8:00 AM, it won’t run until then. Additionally, running scheduled tasks too frequently can affect site performance. For more information, see the Troubleshooting Scheduled Events guide.