Often times you use Gravity Forms to collect sensitive user information, so today we are going to learn how to prevent Gravity Forms from storing entries in WordPress.
Gravity Forms is an awesome WordPress plugin. I use it on every site that I build to give my visitors a way to interact with me (you can see an example on my contact page).
Security should always be relevant and at the forefront of any discussion that relates to user information. You don’t want to be held liable for that information, especially if it contains anything that could be damaging like usernames, logins and passwords to websites. Because of Gravity Forms stores this data on your site without encryption, the damage done by a hacker could be exponential if they discover this data in your database.
In that light, I’ve written up some code that will automatically remove any entry data that Gravity Forms attempts to store once a submission has taken place. Simply drop this code below into your theme’s
functions.php file and it will prevent Gravity Forms from storing entries in your WordPress database ever again.
If you want to prevent entries from being stored on only one specific entry, you can target it like this. Simply change the number at the end of the hook to match your specific form ID.
If you are worried about somehow losing that data or the data never making it to your, I suggest checking out my tutorial on configuring Gravity Forms and Gmail so that things submitted from your site never get misplaced or lost in spam again.