How to Automatically Empty WordPress Trash Daily

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?

Empty wordpress thrash

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.


  1. Hariom says:

    Very handy tip about optimising wp database and free the database from spam comments. Any config hack to avoid spam comments will greately help the spam commenters in first place.

  2. Trung @ Blogging 24 Hours says:

    Very simply and useful tips, thanks so much!

  3. Tech Crates says:

    Great tip…. Will make use of it to save some time that can be invested in marketing

  4. Mandarin Man says:

    Good info here, I’m going to do this on all my wordpress sites.

  5. eTipsLibrary says:

    Great and interesting tip. Most of wordpress users will adopt it.

  6. Praveen says:

    Nice Idea, i don’t like to have things in trash!

    Cheers !

  7. Criar MSN says:

    Very good this tip!

    It really is very helpful!

  8. Swamykant says:

    Simple and easy to use trick. Thanks for share.

  9. promosyon says:

    Your site is very good. There are useful information and most importantly, for sharing great. Thank you.

Leave a Reply

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