Our WordPress hosting users have asked us so many times to help them by telling them the ways to delete entries in the trash of WordPress automatically. In this knowledge base, we are going to discuss an easy way to delete the trash in WordPress and make some free space in the server.
In WordPress, the wp-config.php function is used to control the time frame for which the data would be held in WordPress trash. So, by editing the period you can reduce the number of days for the data to be retained in WordPress. This makes you free from the regular checking of the trash section before you could manually use the ‘Empty Trash’ button.
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.
Also Read :