How to Automatically Empty WordPress Trash Daily

Posted on June 10th, 2011

Do you wish to delete and empty WordPress Trash daily? We delete many spam WordPress comments everyday and WordPress Trash fills up really fast. Often the Trash accumulates thousands of comments. How to empty Trash automatically?

Does WordPress empty Trash ever? WordPress will permanently delete posts, pages or comments in the trash after 30 days automatically. So dont worry about accumulating thousands of Trash files.

How to empty WordPress Trash Daily

You can decide when to empty the WordPress trash by adding this code to the wp-config.php file in your WordPress root directory.

define('EMPTY_TRASH_DAYS', 1 );

The 1 in the code signifies you want to empty the trash everyday. If you use a value like 5, it will empty trash every 5 days. If you set to 0, the trash functionality will be disabled and the ‘Delete Permanently’ button will appear instead of ‘Trash’ button and then you can delete posts and comments permanently without any alert. Remember to always backup wp-config.php file before editing it or your blog function may be disrupted.

Now never click Empty Trash ever again.