Trash Hoarding Tutorial: An Informative How-To

in WordPress Tutorials

With the release of WordPress 2.9 came the inclusion of several much needed improvements. One of those improvements involved the trash bin, which houses all the discarded comments, trackbacks and related responses the site admin has decided to throw away.

By default, when a comment or an item is trashed it remains in the recycle bin for up to 30 days. This allows site admins the chance to recover any accidentally deleted items.

But what if you wanted to collect more than 30 days of trash in your bin? What if you wanted to hoard those discarded comments and items? On the flip side, what if you wanted to lessen the time the trash bin stored the items by default?

All of the above options can be performed simply by adding (and changing) a single line of code in the “wp-config.php” source file.

To start, open up the “wp-config.php” source file using your preferred means and add in the following line (By default the code listed below is not included in the “wp-config.php” file which is why we must add it):

define('EMPTY_TRASH_DAYS', 30 );

To change the total number of days that files are stored by default simply switch the number “30” to the number you desire.

For a quick example, lets say we wanted to change the time trash bin items were stored to ten days. We would simply input the following line of code into our “wp-config.php” source file.

define('EMPTY_TRASH_DAYS', 10 );

See how simple that was? Now we can go back to rubbing our monitor and admiring our “precious” trash bin items, which now have an increased storage capacity of 300 days!