
{"id":5727,"date":"2013-11-12T16:52:02","date_gmt":"2013-11-12T21:52:02","guid":{"rendered":"http:\/\/www.gravityplugins.com\/documentation\/"},"modified":"2025-12-04T06:07:27","modified_gmt":"2025-12-04T11:07:27","slug":"delete-entry-data-after-submission","status":"publish","type":"post","link":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/","title":{"rendered":"Delete Entry Data after Submission"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-overview\">Overview<\/h2>\n\n\n\n<p>By default, Gravity Forms is designed to record all submitted data. Entries must be saved so notifications can be sent and feed-based add-ons, such as PayPal or User Registration, can process correctly. For this reason, there is no built-in setting to prevent entry creation at the moment of submission.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-automatic-deletion-recommended\">Automatic Deletion (Recommended)<\/h2>\n\n\n\n<p>Gravity Forms 2.4 and newer include Personal Data Settings, which provide the ability <strong>to\u00a0delete entries after a specified number of days automatically.<\/strong><\/p>\n\n\n\n<p>This is the recommended solution for most sites that need automated cleanup or short-term retention.<\/p>\n\n\n\n<p>When an entry is deleted, any associated file uploads are also removed. To retain files while still deleting entries, use the <a href=\"https:\/\/docs.gravityforms.com\/gform_field_types_delete_files\/\">gform_field_types_delete_files<\/a> filter.<\/p>\n\n\n\n<h2 id=\"h-third-party-solutions\" class=\"wp-block-heading\">Third-Party Solutions<\/h2>\n\n\n\n<p>Several third-party add-ons support deleting entries immediately upon submission or on a scheduled basis:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gravityflow.io\/\">Gravity Flow Form Connector Extension<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/gravitywiz.com\/documentation\/gravity-forms-disable-entry-creation\/\" target=\"_blank\" rel=\"noreferrer noopener\">Disable Entry Creation Perk by Gravity Wiz<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/cosmicgiant.com\/plugins\/entry-automation\/\" target=\"_blank\" rel=\"noreferrer noopener\">Entry Automation by CosmicGiant<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/codecanyon.net\/item\/gravity-forms-encrypted-fields\/18564931\" target=\"_blank\" rel=\"noreferrer noopener\">Gravity Forms Encrypted Fields by PluginOwl<\/a><\/li>\n<\/ul>\n\n\n\n<h2 id=\"h-custom-code-option\" class=\"wp-block-heading\">Custom Code Option<\/h2>\n\n\n\n<p>If you prefer not to use one of the above solutions, you can use custom code in the theme&#8217;s functions.php file or a custom functionality plugin that waits until the data is recorded, and then removes the entry that was just created. To do so, you would use the following code, which works with Gravity Forms 1.8 and newer:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Target submissions from form ID 1.\n\/\/ Change gform_after_submission_1 to reflect your target form ID, or use gform_after_submission to target all forms.\nadd_action( 'gform_after_submission_1', 'remove_form_entry' );\nfunction remove_form_entry( $entry ) {\n    GFAPI::delete_entry( $entry&#x5B;'id'] );\n}\n<\/pre><\/div>\n\n\n<p>The following code applies to Gravity Forms 1.7 and earlier only.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n\/\/ Target submissions from form ID 1.\n\/\/ Change gform_after_submission_1 to reflect your target form ID, or use gform_after_submission to target all forms.\nadd_action( 'gform_after_submission_1', 'remove_form_entry' );\nfunction remove_form_entry( $entry ) {\n    GFAPI::delete_entry( $entry&#x5B;'id'] );\n}\n<\/pre><\/div>\n\n\n<p>The expected behavior would be that the entry would not exist in the Gravity Forms database tables after submission. If you are experiencing issues with this script, please refer to our <a data-autolink=\"autolink_gform_after_submission\" href=\"\/gform_after_submission\">gform_after_submission<\/a> hook.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-placement\">Placement<\/h2>\n\n\n\n<p>This code can be used in the <a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/theme-functions\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">functions.php<\/a> file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.<\/p>\n\n\n\n<p>See also the PHP section in this article: <a href=\"https:\/\/docs.gravityforms.com\/where-do-i-put-this-code\/\" target=\"_blank\" rel=\"noreferrer noopener\">Where Do I Put This Code?<\/a><\/p>\n\n\n\n<p><em>\u200b<strong>Disclaimer<\/strong>: Third-party se<\/em>rvices, <em>plugins, or code snippets that are referenced by our Support documentation or in Support Team communications are provided as suggestions only. We do not evaluate, test or officially support third-party solutions. You are wholly responsible for determining if any suggestion given is sufficient to meet the functional, security, legal, ongoing cost and support needs of your project.<\/em><br><br><em><em><em>Feedback, feature, and integration requests, and other functionality ideas can be submitted at <\/em><\/em><\/em><a href=\"http:\/\/forms.roadmap.gravity.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><a href=\"https:\/\/gravity.com\/feature-request\/\">https:\/\/gravity.com\/feature-request\/<\/a><em><em><em>.<\/em><\/em><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_autodraft_ids":[],"_sb_is_suggestion_mode":false,"_sb_show_suggestion_boards":false,"_sb_show_comment_boards":false,"_sb_suggestion_history":"","_sb_update_block_changes":"","_is_real_time_mode":false,"_realtime_collaborators":"","footnotes":"","jetpack_post_was_ever_published":false,"_members_access_role":[],"_members_access_error":"","cf_checklist_status":["SEO Title Length","Content Word Count","Internal Links","External Links","Alt Text for All Images","Category Assigned"]},"categories":[177],"tags":[],"class_list":["post-5727","post","type-post","status-publish","format-standard","hentry","category-how-to","wpautop"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.9 (Yoast SEO v28.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Delete Entry Data after Submission - Gravity Forms Documentation<\/title>\n<meta name=\"description\" content=\"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Delete Entry Data after Submission\" \/>\n<meta property=\"og:description\" content=\"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/\" \/>\n<meta property=\"og:site_name\" content=\"Gravity Forms Documentation\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-12T21:52:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-04T11:07:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2023\/08\/gf-docs-default-v3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"544\" \/>\n\t<meta property=\"og:image:height\" content=\"288\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Justin Pakes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gravityforms\" \/>\n<meta name=\"twitter:site\" content=\"@gravityforms\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Justin Pakes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/\"},\"author\":{\"name\":\"Justin Pakes\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/person\\\/8a88745ec2ee5bc1bb24eea8634bf376\"},\"headline\":\"Delete Entry Data after Submission\",\"datePublished\":\"2013-11-12T21:52:02+00:00\",\"dateModified\":\"2025-12-04T11:07:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/\"},\"wordCount\":268,\"publisher\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\"},\"articleSection\":[\"How To\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/\",\"name\":\"Delete Entry Data after Submission - Gravity Forms Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#website\"},\"datePublished\":\"2013-11-12T21:52:02+00:00\",\"dateModified\":\"2025-12-04T11:07:27+00:00\",\"description\":\"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/delete-entry-data-after-submission\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/docs.gravityforms.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Delete Entry Data after Submission\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#website\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/\",\"name\":\"Gravity Forms Documentation\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/docs.gravityforms.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#organization\",\"name\":\"Gravity Forms\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/gravity-forms-2020-logo-stacked.png\",\"contentUrl\":\"https:\\\/\\\/docs.gravityforms.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/gravity-forms-2020-logo-stacked.png\",\"width\":392,\"height\":515,\"caption\":\"Gravity Forms\"},\"image\":{\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/gravityforms\",\"http:\\\/\\\/@gravityforms.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/docs.gravityforms.com\\\/#\\\/schema\\\/person\\\/8a88745ec2ee5bc1bb24eea8634bf376\",\"name\":\"Justin Pakes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g\",\"caption\":\"Justin Pakes\"},\"url\":\"https:\\\/\\\/docs.gravityforms.com\\\/author\\\/pakes\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Delete Entry Data after Submission - Gravity Forms Documentation","description":"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/","og_locale":"en_US","og_type":"article","og_title":"Delete Entry Data after Submission","og_description":"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.","og_url":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/","og_site_name":"Gravity Forms Documentation","article_published_time":"2013-11-12T21:52:02+00:00","article_modified_time":"2025-12-04T11:07:27+00:00","og_image":[{"width":544,"height":288,"url":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2023\/08\/gf-docs-default-v3.png","type":"image\/png"}],"author":"Justin Pakes","twitter_card":"summary_large_image","twitter_creator":"@gravityforms","twitter_site":"@gravityforms","twitter_misc":{"Written by":"Justin Pakes","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/#article","isPartOf":{"@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/"},"author":{"name":"Justin Pakes","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/person\/8a88745ec2ee5bc1bb24eea8634bf376"},"headline":"Delete Entry Data after Submission","datePublished":"2013-11-12T21:52:02+00:00","dateModified":"2025-12-04T11:07:27+00:00","mainEntityOfPage":{"@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/"},"wordCount":268,"publisher":{"@id":"https:\/\/docs.gravityforms.com\/#organization"},"articleSection":["How To"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/","url":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/","name":"Delete Entry Data after Submission - Gravity Forms Documentation","isPartOf":{"@id":"https:\/\/docs.gravityforms.com\/#website"},"datePublished":"2013-11-12T21:52:02+00:00","dateModified":"2025-12-04T11:07:27+00:00","description":"This article explains how how to manage deletion using Personal Data Settings, third-party tools, or custom code.","breadcrumb":{"@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/docs.gravityforms.com\/delete-entry-data-after-submission\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/docs.gravityforms.com\/"},{"@type":"ListItem","position":2,"name":"Delete Entry Data after Submission"}]},{"@type":"WebSite","@id":"https:\/\/docs.gravityforms.com\/#website","url":"https:\/\/docs.gravityforms.com\/","name":"Gravity Forms Documentation","description":"","publisher":{"@id":"https:\/\/docs.gravityforms.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/docs.gravityforms.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/docs.gravityforms.com\/#organization","name":"Gravity Forms","url":"https:\/\/docs.gravityforms.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/logo\/image\/","url":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2020\/01\/gravity-forms-2020-logo-stacked.png","contentUrl":"https:\/\/docs.gravityforms.com\/wp-content\/uploads\/2020\/01\/gravity-forms-2020-logo-stacked.png","width":392,"height":515,"caption":"Gravity Forms"},"image":{"@id":"https:\/\/docs.gravityforms.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/gravityforms","http:\/\/@gravityforms.com"]},{"@type":"Person","@id":"https:\/\/docs.gravityforms.com\/#\/schema\/person\/8a88745ec2ee5bc1bb24eea8634bf376","name":"Justin Pakes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/791cb5bec00c6dd4bec2e80cf4df9638297207d8f77890c96b6b483be434ecea?s=96&d=mm&r=g","caption":"Justin Pakes"},"url":"https:\/\/docs.gravityforms.com\/author\/pakes\/"}]}},"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pdGaEa-1un","_links":{"self":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/5727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/comments?post=5727"}],"version-history":[{"count":4,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/5727\/revisions"}],"predecessor-version":[{"id":47202,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/posts\/5727\/revisions\/47202"}],"wp:attachment":[{"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/media?parent=5727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/categories?post=5727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.gravityforms.com\/wp-json\/wp\/v2\/tags?post=5727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}