Post Pic

How to automatically empty trash on a daily basis

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!

6 Responses

Jul 26 2012 20:03

Its good to trash post automatically

Jul 27 2012 06:42

Thanks for this post! I really wanted to permanently delete the post and comments. I will use this trick for sure :)

Jul 27 2012 10:55

I assume you mean wp-config.php ? ;)

Aug 11 2012 02:24

“I assume you mean wp-config.php ? ”

i was looking for that, nice post and good tips thanks for sharing

Aug 30 2012 12:47

like you mentioned

define(‘EMPTY_TRASH_DAYS’, 1);

do you think

define(‘EMPTY_SPAM_DAYS’, 1);

will work to automatically clean spam folder?

Apr 03 2013 15:02

Nice tut there!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox