# Deleting old entries in bulk \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892>\
**Category:** Get Help\
**Tags:** cosmicgiant, personal-data, old-entries, gravity-flow\
**Created:** [June 18, 2021, 5:05pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892 "2021-06-18T17:05:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [June 18, 2021, 5:05pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/1 "2021-06-18T17:05:23Z")

</div>

Supporting a site with about 5,000 GF submissions across 6 forms - entries span about 4 years total. Client really only needs access to last year of submissions. Planning to backup site, create archive of older entries and leave only 18 months or so on production site.

Deleting them manually is doable, but wanted to see if better approaches exist. Ideally, I’d like to delete attachments also submitted with many entries.

Any advice appreciated.

---

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/david/32/2517_2.png) [@david](https://community.gravityforms.com/u/david)\
**Post date:** [June 24, 2021, 9:15pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/2 "2021-06-24T21:15:08Z")

</div>

Don’t have any ready code for this but I’m thinking you could run a simple function to call [GFAPI::get\_entries()](https://docs.gravityforms.com/api-functions/#get-entries) to fetch all entries (across all forms) that are from before a given date and then loop through each entry and delete it via [GAPI::delete\_entry](https://docs.gravityforms.com/api-functions/#delete-entry).

Hope that helps point you in the right direction!

---

<div class="post-metadata">

**Author:** ![erikvanbeek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/erikvanbeek/32/1850_2.png) [@erikvanbeek](https://community.gravityforms.com/u/erikvanbeek)\
**Post date:** [June 25, 2021, 9:38am UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/3 "2021-06-25T09:38:56Z")

</div>

You can use [https://docs.gravityforms.com/personal-data-settings/#retention-policy](https://docs.gravityforms.com/personal-data-settings/#retention-policy) for each form. If you set this older entries are automatically deleted by GF. This function is triggered by the WordPress cron.

---

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [June 25, 2021, 2:11pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/4 "2021-06-25T14:11:18Z")

</div>

Great ideas, guys. I’ll explore both approaches.

THANK YOU!

---

<div class="post-metadata">

**Author:** ![Trisha](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/trisha/32/1977_2.png) [@Trisha](https://community.gravityforms.com/u/Trisha)\
**Post date:** [June 25, 2021, 9:33pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/5 "2021-06-25T21:33:31Z")

</div>

Possibly an easier way…I had the same need not too long ago (to remove thousands of old entries in bulk) and this is the answer I got, seems like it might work for you too:

" You can use the built in filter on the Entries page to search for ENTRY DATE “less than” and some date (like 2019-01-01 YYYY-MM-DD) and then when the search results are shown on the page, you should have 20 by default (this can be changed if you want by using the Screen Options pull down on the WordPress page.) No matter how many are shown on screen, you can use the “Select all” checkbox at the top of the list, and you will get a nifty message that says:

**All 20 entries on this page are selected. Select all 1844 entries.** (or whatever your numbers are)

“Select all 1844 entries” will be hyperlinked. If you click that link, you get a message that says “All **1844** entries have been selected” and now you can do whatever you want with them. In your case, you can use the **Bulk Actions** drop down to “Trash” them all. Select “Trash” then click “Apply” - that will mark them all as Trash. Click the Trash link, and then you can use the “Empty Trash” button or the “Select all” checkbox again and then the bulk action of “Delete Permanently”.

That will clear out entries older than the search criteria date you used.

If you want to automate this in the future to avoid the manual intervention, you could use this third-party plugin:

[Entry Automation – Automatically export your Gravity Forms entries](https://forgravity.com/plugins/entry-automation/)

---

<div class="post-metadata">

**Author:** ![JamieO](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/jamieo/32/2521_2.png) [@JamieO](https://community.gravityforms.com/u/JamieO)\
**Post date:** [July 7, 2021, 3:26am UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/6 "2021-07-07T03:26:49Z")

</div>

Two additional tools for your deletion toolkit to consider:

- [Gravity Forms CLI](https://en-ca.wordpress.org/plugins/gravityformscli/)
- [Gravity Flow Form Connector](https://gravityflow.io/downloads/form-connector/) with its’ [Delete an Entry Step](https://docs.gravityflow.io/article/201-delete-an-entry) step type to ensure that going forward, entries could be deleted after X months.

---

<div class="post-metadata">

**Author:** ![crucesignati](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/crucesignati/32/2755_2.png) [@crucesignati](https://community.gravityforms.com/u/crucesignati)\
**Post date:** [July 25, 2021, 7:56pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/7 "2021-07-25T19:56:34Z")

</div>

These were all great suggestions but wound up using GF’s [Personal Data retention tools](https://docs.gravityforms.com/personal-data-settings/?&_ga=2.124051274.1914553761.1627240454-1292502469.1620684326#retention-policy) and it worked like a champ but with a few caveats:

1. Personal data is deleted by cron job so when entries actually get removed depends upon when your server runs GF maintenance cron jobs. They run once every 24 hours.

2. If you also choose to remove any associated media (i.e. form uploads), that also happens by a cron job but at a different time than the job above. This also runs once every 24 hours.

I selected both options (remove entries and remove form uploads) then checked total number of entries 4 hours later. Entries older than 1 year had been removed but uploads associated with those entries were not removed until sometime overnight.

Worth noting that total size of site in gigabytes was reduced by more than half after uploads had been removed.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [July 25, 2021, 9:13pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/8 "2021-07-25T21:13:25Z")

</div>

Thanks for the update @crucesignati.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [July 25, 2021, 9:13pm UTC](https://community.gravityforms.com/t/deleting-old-entries-in-bulk-resolved/9892/9 "2021-07-25T21:13:28Z")

</div>


