{"id":1003,"date":"2025-03-24T14:28:15","date_gmt":"2025-03-24T14:28:15","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/how-to-prevent-logged-out-posting-auto-save-feature\/"},"modified":"2025-04-03T15:24:36","modified_gmt":"2025-04-03T14:24:36","slug":"how-to-prevent-logged-out-posting-auto-save-feature","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/code-snippets\/how-to-prevent-logged-out-posting-auto-save-feature\/","title":{"rendered":"How to Prevent logged out posting auto save feature"},"content":{"rendered":"\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">We recommend using the <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/useful-plugins\/code-snippets-plugin\/\">Code Snippets<\/a> plugin to add snippets to your site.&nbsp;<\/span><\/div>\n\n\n\n<p>Our system has a feature that when a user enters data it is auto-saved in the background so it&#8217;s not lost and a user can return to work on it later if they are called away or have computer problems.&nbsp; For logged-out users this will register a user BEFORE a user submits the information, some users have expressed that they do not want this to happen.&nbsp;&nbsp;<\/p>\n\n\n\n<p>The below code snippet will disable the autosave feature for logged-out users only, the listing and user will only be created when the user clicks the submit button.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-php\">add_action( &#039;init&#039;,&#039;_prevent_logged_out_auto_save&#039;);\nfunction _prevent_logged_out_auto_save(){\n\tif(!get_current_user_id()){\n\t\tremove_action( &#039;wp_ajax_nopriv_geodir_auto_save_post&#039;, array( &#039;GeoDir_AJAX&#039;, &#039;auto_save_post&#039; ) );\n\t}\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Our system has a feature that when a user enters data it is auto-saved in the background so it&#8217;s not lost and a user can return to work on it later if they are called away or have computer problems.&nbsp; For logged-out users this will register a user BEFORE a user submits the information, some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,433],"class_list":["post-1003","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-code-snippets"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=1003"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/1003\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=1003"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=1003"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}