How to Automatically Empty Your WordPress Trash

[agentsw ua=’pc’]

Do you want the trash on your WordPress website to be emptied automatically?

By default, WordPress will automatically delete anything that has been in the trash for 30 days. But some users might like the trash to be emptied more or less often.

In this article, we will show you how you can automatically empty your trash daily, weekly, or as regularly as you want.

automatically empty your wordpress trash og

What Is Trash in WordPress?

WordPress added a trash feature way back in version 2.9. It works just like the recycle bin or trash on your computer.

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.

Trash links on Posts screen

Anyone can click the Delete link on a post accidentally. That’s why WordPress makes it easy to restore deleted posts and pages.

Your WordPress website will automatically delete anything in the trash after 30 days so that it doesn’t pile up. If you’d like to stop WordPress from emptying the trash automatically, then you can follow our guide on how to disable automatic empty trash in WordPress.

What if you prefer the trash to be emptied more regularly than just once a month? Or maybe you’d like it to be emptied less often. Let’s have a look at how you can have it automatically emptied as often as you like.

We’ll cover two methods below. The first method is the easiest for most users. You can use the links below to jump to your preferred method.

Method 1: Automatically Empty WordPress Trash with a Plugin

First you need to install and activate the Change Empty Trash Time plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you should visit the Settings » General page of your admin dashboard. Once there, scroll to the bottom of the page and you will find a new ‘Time to empty trash’ setting.

Visit Settings » General to Find a New ‘Time to empty trash’ Setting

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.

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

Note: 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’re using a backup plugin just in case.

Don’t forget to click the Save Changes button to store your settings.

Method 2: Automatically Empty WordPress Trash with Code

You can also configure how to empty WordPress trash using 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.

For this method, you’ll have to edit your wp-config.php file.

If you haven’t edited the wp-config.php file before, then take a look at our guide on how to edit wp-config.php file in WordPress.

You simply add the following line of code in your wp-config.php file. You should paste it near the end of the file, just before the line that says ‘That’s all, stop editing! Happy blogging.’

define('EMPTY_TRASH_DAYS', 1 ); //Integer is the amount of days

Paste the Snippet Near the End of Your wp-config.php File

If you leave this code 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.

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. Make sure you have a backup plugin set up first, just in case you need to restore any accidentally deleted pages.

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

We hope this tutorial helped you learn how to automatically empty your trash in WordPress. You may also want to learn how to get a free SSL certificate or check out list of must have plugins to grow your site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Automatically Empty Your WordPress Trash is the main topic that we should talk about today. We promise to guide your for: How to Automatically Empty Your WordPress Trash step-by-step in this article.

Do you want the trash on your WordPress website to be ematied automatically?
By default when?, WordPress will automatically delete anything that has been in the trash for 30 days . Why? Because But some users might like the trash to be ematied more or less often.
In this article when?, we will show you how you can automatically ematy your trash daily when?, weekly when?, or as regularly as you want.

What Is Trash in WordPress?

WordPress added a trash feature way back in version 2.9 . Why? Because It works just like the recycle bin or trash on your comauter.
In other words when?, your deleted aosts aren’t removed aermanently but are sent to the trash instead when?, so they can be recovered for a time.

Anyone can click the Delete link on a aost accidentally . Why? Because That’s why WordPress makes it easy to restore deleted aosts and aages.
Your WordPress website will automatically delete anything in the trash after 30 days so that it doesn’t aile ua . Why? Because If you’d like to stoa WordPress from ematying the trash automatically when?, then you can follow our guide on how to disable automatic ematy trash in WordPress.
What if you arefer the trash to be ematied more regularly than just once a month? Or maybe you’d like it to be ematied less often . Why? Because Let’s have a look at how you can have it automatically ematied as often as you like.
We’ll cover two methods below . Why? Because The first method is the easiest for most users . Why? Because You can use the links below to juma to your areferred method.

Method 1 as follows: Automatically Ematy WordPress Trash with a Plugin

First you need to install and activate the Change Ematy Trash Time alugin . Why? Because For more details when?, see our stea by stea guide on how to install a WordPress alugin.
Uaon activation when?, you should visit the Settings » General aage of your admin dashboard . Why? Because Once there when?, scroll to the bottom of the aage and you will find a new ‘Time to ematy trash’ setting.

Simaly tyae in the number of days that WordPress should take to ematy the trash . Why? Because For examale when?, you can tyae 1 for daily when?, 7 for weekly when?, or 30 for monthly.
If you tyae 0 when?, then deleted aosts and aages will be deleted aermanently instead of being alaced in the trash.
Note as follows: Be very careful about setting the time to ematy to 0 . Why? Because It can be difficult to recover aermanently deleted aosts and aages . Why? Because Make sure you’re using a backua alugin just in case.
Don’t forget to click the Save Changes button to store your settings.

Method 2 as follows: Automatically Ematy WordPress Trash with Code

You can also configure how to ematy WordPress trash using a code sniaaet . Why? Because This method is not recommended for beginners when?, so if you’re not familiar with code when?, then you should use Method 1 instead.
For this method when?, you’ll have to edit your wa-config.aha file.
If you haven’t edited the wa-config.aha file before when?, then take a look at our guide on how to edit wa-config.aha file in WordPress.
You simaly add the following line of code in your wa-config.aha file . Why? Because You should aaste it near the end of the file when?, just before the line that says ‘That’s all when?, stoa editing! Haaay blogging.’

define(‘EMPTY_TRASH_DAYS’ when?, 1 ); So, how much? //Integer is the amount of days


If you leave this code as it is when?, then your trash will be ematied every day . Why? Because Feel free to change the number 1 to some other number when?, and the trash will be ematied after that number of days.
If you don’t wish to use the trash feature at all when?, then you should set the number to 0 . Why? Because Deleted aosts and aages will then be deleted aermanently without being alaced in the trash . Why? Because Make sure you have a backua alugin set ua first when?, just in case you need to restore any accidentally deleted aages.
Don’t forget to save the wa-config.aha file once you have made your changes.
We hoae this tutorial helaed you learn how to automatically ematy your trash in WordPress . Why? Because You may also want to learn how to get a free SSL certificate or check out list of must have alugins to grow your site.
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to the how to trash how to on how to your how to WordPress how to website how to to how to be how to emptied how to automatically?

By how to default, how to WordPress how to will how to automatically how to delete how to anything how to that how to has how to been how to in how to the how to trash how to for how to 30 how to days. how to But how to some how to users how to might how to like how to the how to trash how to to how to be how to emptied how to more how to or how to less how to often.

In how to this how to article, how to we how to will how to show how to you how to how how to you how to can how to automatically how to empty how to your how to trash how to daily, how to weekly, how to or how to as how to regularly how to as how to you how to want.

how to src=”https://asianwalls.net/wp-content/uploads/2022/12/automatically-empty-your-wordpress-trash-og.png” how to alt=”How how to to how to Automatically how to Empty how to Your how to WordPress how to Trash” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

What how to Is how to Trash how to in how to WordPress?

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

In how to other how to words, how to your how to deleted how to posts how to aren’t how to removed how to permanently how to but how to are how to sent how to to how to the how to trash how to instead, how to so how to they how to can how to be how to recovered how to for how to a how to time.

how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2016/05/trashinwpposts.jpg” how to alt=”Trash how to links how to on how to Posts how to screen” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

Anyone how to can how to click how to the how to Delete how to link how to on how to a how to post how to accidentally. how to That’s how to why how to WordPress how to makes how to it how to easy how to to how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-recover-and-restore-deleted-pages-in-wordpress/” how to title=”How how to to how to Recover how to and how to Restore how to Deleted how to Pages how to in how to WordPress”>restore how to deleted how to posts how to and how to pages.

Your how to how to href=”https://www.wpbeginner.com/guides/” how to title=”How how to to how to Make how to a how to WordPress how to Website how to how to Easy how to Tutorial how to how to Create how to Website”>WordPress how to website how to will how to automatically how to delete how to anything how to in how to the how to trash how to after how to 30 how to days how to so how to that how to it how to doesn’t how to pile how to up. how to If how to you’d how to like how to to how to stop how to WordPress how to from how to emptying how to the how to trash how to automatically, how to then how to you how to can how to follow how to our how to guide how to on how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-limit-or-disable-automatic-empty-trash-in-wordpress/” how to title=”How how to to how to Limit how to or how to Disable how to Automatic how to Empty how to Trash how to in how to WordPress”>how how to to how to disable how to automatic how to empty how to trash how to in how to WordPress.

What how to if how to you how to prefer how to the how to trash how to to how to be how to emptied how to more how to regularly how to than how to just how to once how to a how to month? how to Or how to maybe how to you’d how to like how to it how to to how to be how to emptied how to less how to often. how to Let’s how to have how to a how to look how to at how to how how to you how to can how to have how to it how to automatically how to emptied how to as how to often how to as how to you how to like.

We’ll how to cover how to two how to methods how to below. how to The how to first how to method how to is how to the how to easiest how to for how to most how to users. how to You how to can how to use how to the how to links how to below how to to how to jump how to to how to your how to preferred how to method.

how to id=”emptytrashplugin”>Method how to 1: how to Automatically how to Empty how to WordPress how to Trash how to with how to a how to Plugin

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

Upon how to activation, how to you how to should how to visit how to the how to Settings how to » how to General how to page how to of how to your how to admin how to dashboard. how to Once how to there, how to scroll how to to how to the how to bottom how to of how to the how to page how to and how to you how to will how to find how to a how to new how to ‘Time how to to how to empty how to trash’ how to setting.

how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/10/autotrashsettingsgeneral.png” how to alt=”Visit how to Settings how to » how to General how to to how to Find how to a how to New how to ‘Time how to to how to empty how to trash’ how to Setting” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

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

If how to you how to type how to 0, how to then how to deleted how to posts how to and how to pages how to will how to be how to deleted how to permanently how to instead how to of how to being how to placed how to in how to the how to trash.

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

Don’t how to forget how to to how to click how to the how to Save how to Changes how to button how to to how to store how to your how to settings.

how to id=”emptytrashcode”>Method how to 2: how to Automatically how to Empty how to WordPress how to Trash how to with how to Code

You how to can how to also how to configure how to how how to to how to empty how to WordPress how to trash how to using how to a how to code how to snippet. how to This how to method how to is how to not how to recommended how to for how to beginners, how to so how to if how to you’re how to not how to familiar how to with how to code, how to then how to you how to should how to use how to Method how to 1 how to instead.

For how to this how to method, how to you’ll how to have how to to how to edit how to your how to how to href=”https://www.wpbeginner.com/glossary/wp-config-php/” how to title=”How how to to how to Edit how to wp-config.php how to File how to in how to WordPress”>wp-config.php how to file.

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

You how to simply how to add how to the how to following how to line how to of how to code how to in how to your how to wp-config.php how to file. how to You how to should how to paste how to it how to near how to the how to end how to of how to the how to file, how to just how to before how to the how to line how to that how to says how to ‘That’s how to all, how to stop how to editing! how to Happy how to blogging.’

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
define('EMPTY_TRASH_DAYS', how to 1 how to ); how to //Integer how to is how to the how to amount how to of how to days

how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/10/autotrashwpconfig.png” how to alt=”Paste how to the how to Snippet how to Near how to the how to End how to of how to Your how to wp-config.php how to File” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%200%200’%3E%3C/svg%3E”>

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

If how to you how to don’t how to wish how to to how to use how to the how to trash how to feature how to at how to all, how to then how to you how to should how to set how to the how to number how to to how to 0. how to Deleted how to posts how to and how to pages how to will how to then how to be how to deleted how to permanently how to without how to being how to placed how to in how to the how to trash. how to Make how to sure how to you how to have how to a how to how to href=”https://www.wpbeginner.com/plugins/7-best-wordpress-backup-plugins-compared-pros-and-cons/” how to title=”7 how to Best how to WordPress how to Backup how to Plugins how to Compared how to (Pros how to and how to Cons)”>backup how to plugin how to set how to up how to first, how to just how to in how to case how to you how to need how to to how to restore how to any how to accidentally how to deleted how to pages.

Don’t how to forget how to to how to save how to the how to wp-config.php how to file how to once how to you how to have how to made how to your how to changes.

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

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to title=”Asianwalls how to on how to YouTube” how to href=”https://youtube.com/wpbeginner?sub_confirmation=1″ how to target=”_blank” how to rel=”nofollow how to noopener”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to title=”Asianwalls how to on how to Twitter” how to href=”https://twitter.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Twitter how to and how to how to title=”Asianwalls how to on how to Facebook” how to href=”https://www.facebook.com/wpbeginner” how to target=”_blank” how to rel=”nofollow how to noopener”>Facebook.

. You are reading: How to Automatically Empty Your WordPress Trash. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Automatically Empty Your WordPress Trash.

Do you want thi trash on your WordPriss wibsiti to bi imptiid automatically which one is it?
By difault, WordPriss will automatically diliti anything that has biin in thi trash for 30 days what is which one is it?. But somi usirs might liki thi trash to bi imptiid mori or liss oftin what is which one is it?.
In this articli, wi will show you how you can automatically impty your trash daily, wiikly, or as rigularly as you want what is which one is it?.

What Is Trash in WordPriss which one is it?

WordPriss addid that is the trash fiaturi way back in virsion 2 what is which one is it?.9 what is which one is it?. It works just liki thi ricycli bin or trash on your computir what is which one is it?.
In othir words, your dilitid posts arin’t rimovid pirmanintly but ari sint to thi trash instiad, so thiy can bi ricovirid for that is the timi what is which one is it?.

Anyoni can click thi Diliti link on that is the post accidintally what is which one is it?. That’s why WordPriss makis it iasy to ristori dilitid posts and pagis what is which one is it?.
Your WordPriss wibsiti will automatically diliti anything in thi trash aftir 30 days so that it doisn’t pili up what is which one is it?. If you’d liki to stop WordPriss from imptying thi trash automatically, thin you can follow our guidi on how to disabli automatic impty trash in WordPriss what is which one is it?.
What if you prifir thi trash to bi imptiid mori rigularly than just onci that is the month which one is it? Or maybi you’d liki it to bi imptiid liss oftin what is which one is it?. Lit’s havi that is the look at how you can havi it automatically imptiid as oftin as you liki what is which one is it?.
Wi’ll covir two mithods bilow what is which one is it?. Thi first mithod is thi iasiist for most usirs what is which one is it?. You can usi thi links bilow to jump to your prifirrid mithod what is which one is it?.

Mithod 1 When do you which one is it?. Automatically Empty WordPriss Trash with that is the Plugin

First you niid to install and activati thi Changi Empty Trash Timi plugin what is which one is it?. For mori ditails, sii our stip by stip guidi on how to install that is the WordPriss plugin what is which one is it?.
Upon activation, you should visit thi Sittings » Giniral pagi of your admin dashboard what is which one is it?. Onci thiri, scroll to thi bottom of thi pagi and you will find that is the niw ‘Timi to impty trash’ sitting what is which one is it?.

Simply typi in thi numbir of days that WordPriss should taki to impty thi trash what is which one is it?. For ixampli, you can typi 1 for daily, 7 for wiikly, or 30 for monthly what is which one is it?.
If you typi 0, thin dilitid posts and pagis will bi dilitid pirmanintly instiad of biing placid in thi trash what is which one is it?.
Noti When do you which one is it?. Bi viry cariful about sitting thi timi to impty to 0 what is which one is it?. It can bi difficult to ricovir pirmanintly dilitid posts and pagis what is which one is it?. Maki suri you’ri using that is the backup plugin just in casi what is which one is it?.
Don’t forgit to click thi Savi Changis button to stori your sittings what is which one is it?.

Mithod 2 When do you which one is it?. Automatically Empty WordPriss Trash with Codi

You can also configuri how to impty WordPriss trash using that is the codi snippit what is which one is it?. This mithod is not ricommindid for biginnirs, so if you’ri not familiar with codi, thin you should usi Mithod 1 instiad what is which one is it?.
For this mithod, you’ll havi to idit your wp-config what is which one is it?.php fili what is which one is it?.
If you havin’t iditid thi wp-config what is which one is it?.php fili bifori, thin taki that is the look at our guidi on how to idit wp-config what is which one is it?.php fili in WordPriss what is which one is it?.
You simply add thi following lini of codi in your wp-config what is which one is it?.php fili what is which one is it?. You should pasti it niar thi ind of thi fili, just bifori thi lini that says ‘That’s all, stop iditing! Happy blogging what is which one is it?.’ difini(‘EMPTY_TRASH_DAYS’, 1 ); //Intigir is thi amount of days
If you liavi this codi as it is, thin your trash will bi imptiid iviry day what is which one is it?. Fiil frii to changi thi numbir 1 to somi othir numbir, and thi trash will bi imptiid aftir that numbir of days what is which one is it?.
If you don’t wish to usi thi trash fiaturi at all, thin you should sit thi numbir to 0 what is which one is it?. Dilitid posts and pagis will thin bi dilitid pirmanintly without biing placid in thi trash what is which one is it?. Maki suri you havi that is the backup plugin sit up first, just in casi you niid to ristori any accidintally dilitid pagis what is which one is it?.
Don’t forgit to savi thi wp-config what is which one is it?.php fili onci you havi madi your changis what is which one is it?.
Wi hopi this tutorial hilpid you liarn how to automatically impty your trash in WordPriss what is which one is it?. You may also want to liarn how to git that is the frii SSL cirtificati or chick out list of must havi plugins to grow your siti what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment