
Trash is a new functionality from WordPress 2.9. When an item (post, comment, etc) is deleted, it goes in Trash instead of being permanently removed. Here is a tip to tell your WordPress blog to autmatically empty trash every X days.

Trash is a new functionality from WordPress 2.9. When an item (post, comment, etc) is deleted, it goes in Trash instead of being permanently removed. Here is a tip to tell your WordPress blog to autmatically empty trash every X days.
Simply open your wp-config.php file (located at the root of your WOrdPress install) and paste the following code:
define('EMPTY_TRASH_DAYS', 10 );
The second parameter is when to empty trash, in days.
13 Responses
That’s a simple trick. Thanks.
Ohh superb yar.., nice trick thanks.
Keep rocking.
Very useful trick! I’m always forgetting to delete trashed items.
thanks for sharing this tip..
Thanks for this tip, I have just added it to my config file. Will check up on the next few days.
This code will speed up your website a tiny bit. Sometimes, I have up to 100 files in my trash (posts, pages, comments, etc), so it slows things down a tad. Deleting automatically will save space without any effort! Great find!
Nice tip, thanks!
Thanks for the tip, what about repairing the database automatically :
define(‘WP_ALLOW_REPAIR’, TRUE); also in wp-config.php
Nice tips, thanks!
Is it possible to do the same with spams ? automaticaly delete them after X days ?
thanks very much this is very useful to me
Silly question but … can I just add it to anywhere on
wp-config.php
?
So simple and nice
. I guess it done with cron jobs that are so awesome
Trackbacks: