gform_purge_expired_incomplete_submissions_query

Description

Allows the query used to purge expired incomplete (save and continue) submissions to be overridden.

Usage

add_filter( 'gform_purge_expired_incomplete_submissions_query', 'your_function_name', 10 );

Parameters

  • $query array
    The delete, from, and where arguments to be used when the query is performed.

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in v2.1.1.20.

Source Code

$query = array(
    'delete' => 'DELETE',
    'from'   => sprintf( 'FROM %s', self::get_incomplete_submissions_table_name() ),
    'where'  => $wpdb->prepare( 'WHERE date_created < %s', $expiration_date ),
);
 
$query = apply_filters( 'gform_purge_expired_incomplete_submissions_query', $query );
 
$result = $wpdb->query( implode( "n", $query ) );

This filter is located in GFFormsModel::purge_expired_incomplete_submissions() in forms_model.php.