Learn to Delete Trash in WordPress Automatically.
Many of our WordPress hosting customers have requested us to assist them by providing instructions on how to automatically remove entries from WordPress’ trash folder. We’ll go over how to quickly clear up WordPress’s garbage and free up some server space in this knowledge base article.
The duration for which data is stored in WordPress trash may be adjusted using the wp-config.php function in WordPress. Therefore, you may shorten the amount of days that WordPress keeps the data by modifying the period. By doing this, you can stop worrying about constantly checking the trash area before using the “Empty Trash” button by hand.
Perform the following steps to tweak the default configuration settings in WordPress :
By default, WordPress provides 30 days until data is retained in Trash.
You can check it in the wp-config.php file
define( ‘EMPTY_TRASH_DAYS’, 30 ); // 30 days default
Steps to edit trash settings in WordPress :
To change the defined number of days for WordPress to automatically delete posts in the trash, you can edit this in settings.
For example: If you wish that system should automatically delete entries in the trash after 10 days, then edit the entry as :
/* The following command will automatically delete WordPress trash after 10 days */
define( ‘EMPTY_TRASH_DAYS’, 10 );
Steps to stop WordPress from accumulating posts in Trash :
In order to disable the Trash, you will need to set the number of days to zero.
But, it is not recommended to do so, as it may lose your important entries which cannot be retrieved in case you need it. Thus, avid setting the value to zero.
For any assistance regarding WordPress, please reach our technical team via email or chat support from the website.