<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WPWife &#187; disable trash in wordpress</title>
	<atom:link href="http://www.wpwife.com/category/disable-trash-in-wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wpwife.com</link>
	<description>WPHelp: fix and optimise WP themes&#38;plugins</description>
	<lastBuildDate>Fri, 21 Nov 2025 12:00:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.38</generator>
	<item>
		<title>How to Limit or Disable Automatic Empty Trash in WordPress</title>
		<link>http://www.wpwife.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress</link>
		<comments>http://www.wpwife.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress#comments</comments>
		<pubDate>Tue, 31 Jan 2023 18:58:00 +0000</pubDate>
		<dc:creator><![CDATA[Editorial Staff]]></dc:creator>
				<category><![CDATA[Beginners Guide]]></category>
		<category><![CDATA[change trash empty time in wordpress]]></category>
		<category><![CDATA[disable trash in wordpress]]></category>
		<category><![CDATA[stop wordpress from deleting trash]]></category>
		<category><![CDATA[wordpress trash]]></category>
		<category><![CDATA[wordpress trash schedule]]></category>

		<guid isPermaLink="false">http://www.wpbeginner.com/?p=34310</guid>
		<description><![CDATA[
<p>Do you want to change how often your trash is emptied on your WordPress website, or stop WordPress from emptying the trash automatically? By default, WordPress will automatically delete anything that has been in the trash for 30 days. However, some users might like the&#8230;&#160;<strong><a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/">Read More &#187;</a></strong></p>
<p>The post <a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/">How to Limit or Disable Automatic Empty Trash in WordPress</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Do you want to change how often your trash is emptied on your WordPress website, or stop WordPress from emptying the trash automatically?</p>



<p>By default, WordPress will automatically delete anything that has been in the trash for 30 days. However, some users might like the trash to be emptied more or less often, or prefer to empty the trash manually.</p>



<p>In this article, we will show you how to limit or disable the trash being automatically emptied in WordPress.</p>



<figure class="wp-block-image size-full"><img width="680" height="385" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/how-to-limit-or-disable-automatic-empty-trash-in-wordpress.png" alt="How to Disable Auto Empty Trash in WordPress" class="wp-image-164016" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/how-to-limit-or-disable-automatic-empty-trash-in-wordpress.png 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/how-to-limit-or-disable-automatic-empty-trash-in-wordpress-300x170.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<h4>What Is Trash in WordPress?</h4>



<p>WordPress added a <a title="What Is Trash in WordPress?" href="https://www.wpbeginner.com/glossary/trash/">trash</a> feature way back in version 2.9. It works just like the recycle bin or trash on your computer.</p>



<p>In other words, your deleted posts aren’t removed permanently but are sent to the trash instead so they can be recovered for a time. Anyone can delete a post accidentally. That&#8217;s why WordPress makes it easy to <a href="https://www.wpbeginner.com/beginners-guide/how-to-recover-and-restore-deleted-pages-in-wordpress/">restore deleted posts and pages</a>.</p>



<p>You can view them by going to <strong>Posts » All Posts</strong> from your WordPress dashboard and then clicking the &#8216;Trash&#8217; option. </p>



<figure class="wp-block-image size-full"><img width="680" height="213" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/view-trashed-posts-1.PNG" alt="View trashed posts" class="wp-image-164008" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/view-trashed-posts-1.PNG 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/view-trashed-posts-1-300x94.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Your <a title="How to Make a WordPress Website - Easy Tutorial - Create Website" href="https://www.wpbeginner.com/guides/">WordPress website</a> will automatically delete anything in the trash after 30 days so that it doesn&#8217;t pile up.</p>



<p>What if you don’t want WordPress to <a href="https://www.wpbeginner.com/wp-tutorials/how-to-automatically-empty-your-wordpress-trash/" title="How to Automatically Empty Your WordPress Trash">automatically delete items</a> from the trash? Or you&#8217;d prefer it to be emptied more or less often than once a month.</p>



<p>Let’s have a look at how you can have it automatically emptied as often as you like. We&#8217;ll cover three methods below. The first method is the easiest for most users. You can use the links below to jump to your preferred method.</p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/#wptrash-plugin">Method 1: Changing when WordPress Trash Is Emptied with a Plugin</a></li><li><a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/#wptrash-code">Method 2: Changing when WordPress Trash Is Emptied with Code</a></li><li><a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/#wptrash-stopping">Method 3: Stopping WordPress from Automatically Emptying Trash</a></li></ul></div>



<h4 id="wptrash-plugin">Method 1: Changing when WordPress Trash Is Emptied with a Plugin</h4>



<p>First, you need to install and activate the <a title="Change Empty Trash Time" href="https://wordpress.org/plugins/change-wp-empty-trash-time/"  rel="nofollow noopener">Change Empty Trash Time</a> plugin. For more details, see our step-by-step guide on <a title="How to Install a WordPress Plugin – Step by Step for Beginners" href="https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/">how to install a WordPress plugin</a>.</p>



<p>Upon activation, you should visit the <strong>Settings » General</strong> page of your admin dashboard. Once there, scroll to the bottom of the page, and you will find a new ‘Time to empty trash (in days)’ setting.</p>



<figure class="wp-block-image size-full"><img width="680" height="218" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/enpty-trash-can-after-certain-days.PNG" alt="Empty trash can after certain days" class="wp-image-164009" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/enpty-trash-can-after-certain-days.PNG 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/enpty-trash-can-after-certain-days-300x96.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Simply type in the number of days that WordPress should take to empty the trash. For example, you can type 1 for daily, 7 for weekly, or 30 for monthly.</p>



<p>If you type 0, then deleted posts and pages will be deleted permanently instead of being placed in the trash.</p>



<p><strong>Note</strong>: Be very careful about setting the time to empty to 0. It can be difficult to recover permanently deleted posts and pages. Make sure you&#8217;re using a <a title="7 Best WordPress Backup Plugins Compared (Pros and Cons)" href="https://www.wpbeginner.com/plugins/7-best-wordpress-backup-plugins-compared-pros-and-cons/">backup plugin</a>, just in case.</p>



<p>Don’t forget to click the &#8216;Save Changes&#8217; button to store your settings.</p>



<h4 id="wptrash-code">Method 2: Changing when WordPress Trash Is Emptied with Code</h4>



<p>You can also configure how regularly the trash is emptied by the use of a code snippet. This method is not recommended for beginners, so if you’re not familiar with code, then you should use Method 1 instead.</p>



<p>For this method, you&#8217;ll have to edit your <a title="How to Edit wp-config.php File in WordPress" href="https://www.wpbeginner.com/glossary/wp-config-php/">wp-config.php</a> file.</p>



<p>If you haven&#8217;t edited the wp-config.php file before, then take a look at our guide on <a title="How to Edit wp-config.php File in WordPress" href="https://www.wpbeginner.com/beginners-guide/how-to-edit-wp-config-php-file-in-wordpress/">how to edit wp-config.php file</a> in WordPress.</p>



<p>You can simply add the following line of code to your wp-config.php file. </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
define('EMPTY_TRASH_DAYS', 1 ); //Integer is the amount of days
</pre></div>


<p>You should paste it near the end of the file, just before the line that says, <em>&#8216;That&#8217;s all, stop editing! Happy blogging.&#8217;</em></p>



<figure class="wp-block-image size-full"><img width="680" height="289" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/auto-trash-code-in-wpconfig.png" alt="Auto trash code in wpconfig" class="wp-image-164010" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/auto-trash-code-in-wpconfig.png 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/auto-trash-code-in-wpconfig-300x128.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>If you leave this code snippet as it is, then your trash will be emptied every day. Feel free to change the number 1 to some other number, and the trash will be emptied after that number of days.</p>



<p>If you don’t wish to use the trash feature at all, then you should set the number to 0. Deleted posts and pages will then be deleted permanently without being placed in the trash. </p>



<p>Make sure you have a <a title="7 Best WordPress Backup Plugins Compared (Pros and Cons)" href="https://www.wpbeginner.com/plugins/7-best-wordpress-backup-plugins-compared-pros-and-cons/">backup plugin</a> set up first, just in case you need to restore any accidentally deleted pages.</p>



<p>Don’t forget to save the wp-config.php file once you have made your changes.</p>



<h4 id="wptrash-stopping">Method 3: Stopping WordPress from Automatically Emptying Trash</h4>



<p>Do you want to stop WordPress from automatically deleting items from the trash? </p>



<p>Simply add the little code snippet below into your theme&#8217;s <a title="What is functions.php File in WordPress?" href="https://www.wpbeginner.com/glossary/functions-php/">functions.php</a> file. If you&#8217;re not used to editing your core WordPress files, check out our guide on <a href="https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/" title="Beginner’s Guide to Pasting Snippets from the Web into WordPress">copying and pasting code snippets from the web</a>.</p>



<p>Now, we don&#8217;t generally recommend editing your site&#8217;s theme files directly. The slightest mistake can break your website. A better way of adding code snippets is by using <a href="https://wpcode.com/"  title="WPCode - WordPress Code Snippet Plugin" rel="noopener">WPCode</a>. </p>



<p>First, you&#8217;ll need to install and activate the <a href="https://wordpress.org/plugins/insert-headers-and-footers"  title="WPCode Free Code Snippet Plugin for WordPress" rel="noopener">free WPCode plugin</a>. For more details, please see our guide on <a href="https://www.wpbeginner.com/beginners-guide/step-by-step-guide-to-install-a-wordpress-plugin-for-beginners/" title="How to Install a WordPress Plugin – Step by Step for Beginners">how to install a plugin</a>. </p>



<p>After that, you can go to <strong>Code Snippets » + Add Snippet</strong> from your WordPress dashboard and then select the &#8216;Add Your Custom Code (New Snippet) option.</p>



<figure class="wp-block-image size-full"><img width="680" height="284" src="https://www.wpbeginner.com/wp-content/uploads/2020/06/facebookogwpcodeaddcustomsnippet.png" alt="Adding Your Custom Code in WPCode" class="wp-image-158641" srcset="https://www.wpbeginner.com/wp-content/uploads/2020/06/facebookogwpcodeaddcustomsnippet.png 680w, https://www.wpbeginner.com/wp-content/uploads/2020/06/facebookogwpcodeaddcustomsnippet-300x125.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Next, you will need to enter a title for your code snippet. </p>



<p>Then, copy this snippet and paste it into the box labeled &#8216;Code Preview.&#8217;</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
function wpb_remove_schedule_delete() {
    remove_action( 'wp_scheduled_delete', 'wp_scheduled_delete' );
}
add_action( 'init', 'wpb_remove_schedule_delete' );
</pre></div>


<p>This code simply removes the action that deletes trashed items when their time is up.</p>



<p>Don&#8217;t forget to click the &#8216;Code Type&#8217; dropdown menu and select the &#8216;PHP Snippet&#8217; option. </p>



<figure class="wp-block-image size-full"><img width="680" height="318" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/enter-a-title-for-code.PNG" alt="Enter a title for code" class="wp-image-164011" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/enter-a-title-for-code.PNG 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/enter-a-title-for-code-300x140.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>After that, you can scroll down to the &#8216;Insertion&#8217; section to view more options, such as how and where you&#8217;d like to insert the code. </p>



<p>We recommend using the default options. The plugin will <strong>Auto Insert</strong> the code and run it everywhere on your site. </p>



<figure class="wp-block-image size-full"><img width="680" height="263" src="https://www.wpbeginner.com/wp-content/uploads/2013/12/select-code-insertion-options.png" alt="Select the default Auto Insert method in WPCode" class="wp-image-138358" srcset="https://www.wpbeginner.com/wp-content/uploads/2013/12/select-code-insertion-options.png 680w, https://www.wpbeginner.com/wp-content/uploads/2013/12/select-code-insertion-options-300x116.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>You can then click the toggle to make your code snippet <strong>Active</strong>. </p>



<p>Once that&#8217;s done, simply click the &#8216;Save Snippet&#8217; button at the top. </p>



<figure class="wp-block-image size-full"><img width="680" height="306" src="https://www.wpbeginner.com/wp-content/uploads/2011/09/save-snippet-wpcode.png" alt="Save and activate code snippet WPCode" class="wp-image-134879" srcset="https://www.wpbeginner.com/wp-content/uploads/2011/09/save-snippet-wpcode.png 680w, https://www.wpbeginner.com/wp-content/uploads/2011/09/save-snippet-wpcode-300x135.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>Now when you send an item to the trash, it will remain there until you view your trashed files.</p>



<p>From here, you can manually click on the &#8216;Empty Trash&#8217; button to delete any post. </p>



<figure class="wp-block-image size-full"><img width="680" height="213" src="https://www.wpbeginner.com/wp-content/uploads/2016/05/click-empty-trash-button.png" alt="Click empty trash button" class="wp-image-164014" srcset="https://www.wpbeginner.com/wp-content/uploads/2016/05/click-empty-trash-button.png 680w, https://www.wpbeginner.com/wp-content/uploads/2016/05/click-empty-trash-button-300x94.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></figure>



<p>We hope this tutorial helped you learn how to limit or disable automatic empty trash in WordPress. You may also want to learn <a title="How to Get a Free SSL Certificate for Your WordPress Website (Beginner’s Guide)" href="https://www.wpbeginner.com/beginners-guide/how-to-get-a-free-ssl-certificate-for-your-wordpress-website/">how to get a free SSL certificate</a> or check out <a title="24 'Must Have' WordPress Plugins &amp; Tools for Business Sites" href="https://www.wpbeginner.com/showcase/24-must-have-wordpress-plugins-for-business-websites/">list of must have plugins</a> to grow your site.</p>



<p>If you liked this article, then please subscribe to our <a href="https://youtube.com/wpbeginner?sub_confirmation=1"  rel="noreferrer noopener nofollow" title="Subscribe to WPBeginner YouTube Channel">YouTube Channel</a> for WordPress video tutorials. You can also find us on <a href="https://twitter.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Follow WPBeginner on Twitter">Twitter</a> and <a href="https://facebook.com/wpbeginner"  rel="noreferrer noopener nofollow" title="Join WPBeginner Community on Facebook">Facebook</a>.</p><p>The post <a href="https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/">How to Limit or Disable Automatic Empty Trash in WordPress</a> first appeared on <a href="https://www.wpbeginner.com/">WPBeginner</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.wpwife.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="" length="0" type="" />
		</item>
	</channel>
</rss>
