Knowledge Base
MilesWeb / WordPress FAQ

Learn to Delete Trash in WordPress Automatically.

Approx. read time : 3 min

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

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 */

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 :

1) How To Add Skype Share Button In WordPress?

2) How To Reset Permalinks In WordPress?

Sonam Wagh
With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.