DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

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

7 Comments

  1. Its good to trash post automatically

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

  3. I assume you mean wp-config.php ? 😉

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

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

  5. like you mentioned

    define(‘EMPTY_TRASH_DAYS’, 1);

    do you think

    define(‘EMPTY_SPAM_DAYS’, 1);

    will work to automatically clean spam folder?

  6. There is a code even for emptying the Trash..! Really amazing.

Leave a Comment

Your email address will not be published. Required fields are marked *