The following code will automatically delete Gravity Form entries after submission.
This may be helpful for test or demo forms, or forms that do not need to retain the entry data in the WordPress database – for example, a form that emails the submissions or saves the submission data to another database.
You can use the code by adding it to your theme’s functions.php file (anywhere after the opening <?php line).
add_action( 'gform_after_submission', 'remove_form_entry' ); function remove_form_entry( $entry ) { GFAPI::delete_entry( $entry['id'] ); }
Does this code go in the functions.php of WordPress?
Yes, in the functions.php file in your active theme would do fine – I’ll add it to the instructions for others.
You can actually include code customisations in other places, personally I
put mine in a ‘custom’ plugin – that way when the theme upgrades I dont
loose my code customisations.