In WordPress, there is this “Trash” feature that keep your deleted articles (and comments) in the recycle bin until you go into the bin and delete them permanently. This is an useful feature as it prevents you from deleting any posts/comments accidentally. However, if you don’t have the habit of clearing your trash regularly, it would pile up with useless articles, which in turn translate to bigger database size and slower site loading.
Here’s a quick and simple way to configure your WordPress to automatically clear the trash on a regular basis:
1. Using a FTP application (such as Filezilla), download the wp-config.php file from your server.
2. Open the wp-config.php file with a text editor and insert the following code to the end of the file:
define('EMPTY_TRASH_DAYS', X );
where ‘X’ is the interval (in days) the trash will auto-empty itself.
For example, if you want the trash to auto-empty itself every 7 days, the code will be
define('EMPTY_TRASH_DAYS', 7 );
Disable the trash feature
In some cases, you might want to disable the trash feature altogether. You can do this by setting the number of day to 0. The code become:
define('EMPTY_TRASH_DAYS', 0 );
Our latest tutorials delivered straight to your inbox