Skip to content

Commit e06d738

Browse files
authored
Create gpnf-delete-expired-orphans.php
1 parent 0e3f9ef commit e06d738

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
/**
3+
* Gravity Perks // Nested Forms // Delete Expired Orphan Child Entries (Instead of Trashing)
4+
* https://gravitywiz.com/documentation/gravity-forms-nested-forms/
5+
*/
6+
add_action( 'gform_update_status', function( $entry_id, $new_status ) {
7+
if ( $new_status === 'trash' ) {
8+
$child_entry_expiration = gform_get_meta( $entry_id, GPNF_Entry::ENTRY_EXP_KEY );
9+
if ( $child_entry_expiration ) {
10+
GFAPI::delete_entry( $entry_id );
11+
}
12+
}
13+
}, 10, 2 );

0 commit comments

Comments
 (0)