How to Automatically Empty Trash Items

Snippets by IsItWP

Are you looking for a way to automatically empty trash items? This snippet will automatically empty trash items that have been in the trash more than 3 days.


All you have to do is add this code the wp-config.php file in the root directory of your wordpress install.

define('EMPTY_TRASH_DAYS', 3 );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: How to Easily Back Up Your WordPress Site (Step by Step).

Comments   Leave a Reply

  1. This did not help. I’m looking for the trash icon so I can delete the contents

  2. What’s considered trash? Please.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!