How to automatically empty trash on a daily basis

July 26, 2012 at 5:27 pm

On your WordPress blog, when an item like a post or comment is deleted, it goes in Trash instead of being permanently removed. Here is a super simple code snippet to tell WordPress to automatically empty the trash everydays.

Simply open your wp-config.php file (Located at the root of your WordPress install) and add the following line of code:

define('EMPTY_TRASH_DAYS', 1);

Replace 1 by X to empty spam comments automatically every X days. That’s simple as that!

Tags: