Set Orphaned Entry Expiration Duration
Modify how long entries submitted from a nested form should be saved before being moved to the trash.
Code
Filename: gpnf-set-orphaned-entry-expiration-duration.php
<?php
/**
* Gravity Perks // Nested Forms // Set Orphaned Entry Expiration Duration
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
*
* Modify how long entries submitted from a nested form should be saved before being moved to the trash.
*/
// Expire orphaned entries after 30 days (1 month).
add_filter( 'gpnf_expiration_modifier', function() {
return MONTH_IN_SECONDS;
} );
// Never expire orphaned entries.
add_filter( 'gpnf_expiration_modifier', function() {
return 100 * YEAR_IN_SECONDS;
} );
Is there a way to adjust not just the expiration modifier, but also the frequency that those entries are removed?
I want to set orphaned entries to be removed after 15 minutes, but they won’t disappear until the daily removal of expired entries.
Under the “What happens to child entries when the parent entry is never submitted?” header, I found the following: Expired entries are trashed daily.
I want to make it more frequent than this. Let me know if there is a solution for this.
Hi David,
Here’s a snippet you can use for that.
I hope this helps.
Best,