Using Gravity Forms ‘gform_incomplete_submissions_expiration_days’ PHP filter

The gform_incomplete_submissions_expiration_days filter allows you to override the default number of days until incomplete submissions are purged from the database.


add_filter('gform_incomplete_submissions_expiration_days', 'your_function_name');


  • $expiration_days (int): The number of days until expiration. Defaults to 30.

More information

See Gravity Forms Docs: gform_incomplete_submissions_expiration_days

Note: Using this filter does not change the value displayed in the save and continue confirmation and notification messages. You would need to manually update those messages in the Confirmations and Notifications areas of the Form Settings.


Set Incomplete Submissions Expiration to 90 Days

This example sets the expiration of incomplete submissions to 90 days.

add_filter('gform_incomplete_submissions_expiration_days', 'change_incomplete_submissions_expiration_days');

function change_incomplete_submissions_expiration_days($expiration_days) {
    GFCommon::log_debug('gform_incomplete_submissions_expiration_days: running.');
    $expiration_days = 90;
    return $expiration_days;

Set Expiration Based on Form ID

This example sets a custom expiration for incomplete submissions for form with ID 1 to 60 days.

add_filter('gform_incomplete_submissions_expiration_days', 'change_expiration_based_on_form', 10, 2);

function change_expiration_based_on_form($expiration_days, $form_id) {
    if ($form_id == 1) {
        $expiration_days = 60;
    return $expiration_days;

Set Expiration to Never Expire

This example sets the expiration of incomplete submissions to never expire.

add_filter('gform_incomplete_submissions_expiration_days', 'never_expire_incomplete_submissions');

function never_expire_incomplete_submissions($expiration_days) {
    return 0;

Set Expiration to 7 Days for Specific Forms

This example sets the expiration of incomplete submissions to 7 days for forms with IDs 2 and 3.

add_filter('gform_incomplete_submissions_expiration_days', 'set_specific_forms_expiration', 10, 2);

function set_specific_forms_expiration($expiration_days, $form_id) {
    if (in_array($form_id, array(2, 3))) {
        $expiration_days = 7;
    return $expiration_days;

Double the Expiration Time

This example doubles the expiration time for incomplete submissions.

add_filter('gform_incomplete_submissions_expiration_days', 'double_expiration_time');

function double_expiration_time($expiration_days) {
    return $expiration_days * 2;