Description
The wpforms_save_resume_tasks_deleteexpiredentriestask_expire_period
filter is used to determine how many days should pass before Partial entries are deleted when using the Save and Resume addon.
Parameters
- $expire_period
- (int) (Required) Number of days to delete partial entries from the entries table. Default days are set to 30.
Source
wpforms-save-resume/src/Tasks/DeleteExpiredEntriesTask.php
More Information
The filter is used to determine how many days should pass before partial entries should be removed from the form when using the Save and Resume addon.
By altering the default setting of this filter, this will not automatically delete these entries without manually running the pending scheduled action. To run this action manually, head to WPForms » Tools » Scheduled Actions, and from the Pending section, look for the wpforms_save_resume_clean
action. Under this task, you’ll see an option to Run or Cancel. Select Run to manually run this task and remove these partial entries.
Example
/* * Set the number of days to delete partial entries when using the Save and Resume addon * * @link https://wpforms.com/developers/wpforms_save_resume_tasks_deleteexpiredentriestask_expire_period/ * * @param $expire_period Number of days to delete. * return int */ function wpf_dev_delete_expired_entries( $expire_period ) { // deleted partials after 15 days return '-15 days'; } add_filter( 'wpforms_save_resume_tasks_deleteexpiredentriestask_expire_period', 'wpf_dev_delete_expired_entries', 10, 1 );
You can also use this filter to change it to minutes as well.
/* * Set the number of days to delete partial entries when using the Save and Resume addon * * @link https://wpforms.com/developers/wpforms_save_resume_tasks_deleteexpiredentriestask_expire_period/ * * @param $expire_period Number of days to delete. * return int */ function wpf_dev_delete_expired_entries( $expire_period ) { // delete partials after 1 minute return '-60 seconds'; } add_filter( 'wpforms_save_resume_tasks_deleteexpiredentriestask_expire_period', 'wpf_dev_delete_expired_entries', 10, 1 );