# Don't Keep Entries for Certain Gravity Forms Forms

> Deletes the entry of the forms you list right after its notifications are sent, so sensitive submissions live only in your inbox and never in the database.

- Type: PHP
- Runs: Run everywhere
- Category: [Forms](https://wpide.com/library/category/forms/)
- Tags: gravity-forms, privacy, entries
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/gf-delete-entries-after-notify/

## Code

```php
$wpide_gf_no_storage_forms = array(); // Form IDs whose entries should not be kept, e.g. array( 3 ).

add_action( 'gform_after_submission', function ( $entry, $form ) use ( $wpide_gf_no_storage_forms ) {
    if ( in_array( (int) $form['id'], array_map( 'intval', $wpide_gf_no_storage_forms ), true ) && ! empty( $entry['id'] ) ) {
        GFAPI::delete_entry( (int) $entry['id'] );
    }
}, 999, 2 );
```

## Notes

Runs after notifications and add-on feeds that process on submission; delayed feeds such as payment add-ons would lose their entry, so only list simple contact forms.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Don't Keep Entries for Certain Gravity Forms Forms" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
