{"id":83813,"date":"2018-01-12T09:39:38","date_gmt":"2018-01-12T14:39:38","guid":{"rendered":"https:\/\/www.templatemonster.com\/help\/?p=83813"},"modified":"2018-01-16T05:36:41","modified_gmt":"2018-01-16T10:36:41","slug":"limit-disable-automatic-empty-trash-wordpress","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/limit-disable-automatic-empty-trash-wordpress.html","title":{"rendered":"How to limit or disable automatic empty trash in WordPress"},"content":{"rendered":"<p>Our support team is ready to present you a new tutorial that shows how to limit or disable the automatic empty trash in WordPress.<\/p> \r\n<p>When you delete a post or comment in WordPress, it is placed to the <strong>trash<\/strong> by default. Trashed posts and comments remain in your database for <strong>30 days<\/strong>. In case it is needed you can restore anything from the trash.<\/p>\r\n\r\n<a class=\"darkbox\" href=\"\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1.png\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1.png\" alt=\"\" width=\"848\" height=\"461\" class=\"alignnone size-full wp-image-83814\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1.png 848w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1-150x82.png 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1-300x163.png 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2018\/01\/disable_limit_trash_1-768x418.png 768w\" sizes=\"(max-width: 848px) 100vw, 848px\" \/><\/a>\r\n\r\n<p>After 30 days, WordPress automatically deletes all trash content permanently.<\/p>\r\n<p>In this article, we will explain how to <strong>limit or disable<\/strong> automatic WordPress empty trash feature.<\/p>\r\n<ol>\r\n<li>If you would like WordPress to stop deleting the items from trash automatically, open file <strong>functions.php<\/strong> located in the theme folder. Add the following code to the file:\r\n<pre class=\"brush:php\">function my_remove_schedule_delete() {\r\n    remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );\r\n}\r\nadd_action( 'init', 'my_remove_schedule_delete' );<\/pre>\r\n<p>Now, when you send an item to the trash, it will remain there until you go to the trash and empty it manually.<\/p>\r\n<\/li>\r\n<li>WordPress automatically empties trash after 30 days. You can change this to any number of days you want. In order to do so, you need to add the following line to <strong>wp-config.php<\/strong> file, located in the root folder of your site:\r\n<pre class=\"brush:php\">define('EMPTY_TRASH_DAYS', 7);<\/pre>\r\nYou can change 7 to any other number of days. \r\n<\/li> \r\n<\/ol><p>Feel free to <a href=\"https:\/\/www.templatemonster.com\/blog\/tag\/wordpress\/\" rel=\"noopener\" target=\"_blank\">visit our blog <\/a>to check more tips on working with WordPress templates. Stay tuned!<\/p>","protected":false},"excerpt":{"rendered":"<p>Our support team is ready to present you a new tutorial that shows how to limit or disable the automatic empty trash in WordPress.<\/p>\n","protected":false},"author":56,"featured_media":83817,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2017,728],"tags":[2612,893,1742],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/83813"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=83813"}],"version-history":[{"count":11,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/83813\/revisions"}],"predecessor-version":[{"id":83828,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/83813\/revisions\/83828"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/83817"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=83813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=83813"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=83813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}