How to expire saved forms after hours or minutes

Gravity Forms comes with the ability for users to save and continue forms.

By default forms will automatically expire after 30 days, and this can be customised using the gform_incomplete_submissions_expiration_days filter.

Despite the the filter being named “days” you can actually set the expiration to less than days by returning a floating-point number – for example 0.0416666666666667 for 1 hour.

The example below shows how to set the expiration to 1 hour.

If you’re not sure where to place this code I highly recommend you read How to create a WordPress plugin for your custom functions.

add_filter( 'gform_incomplete_submissions_expiration_days', 'expire_saved_one_hour', 1, 10 );

function expire_saved_one_hour ( $expiration_days ) {
 return 0.0416666666666667;
}

Want another time?

The table below shows other time periods.

Time Value
10 minute 0.0069444444444444
30 minutes 0.0208333333333333
1 hour 0.0416666666666667
2 hours 0.0833333333333334
6 hours 0.0208333333333334

 

Was this article helpful?

Related Articles