Skip to content

How To Automatically Empty Trash In WordPress

The Trash feature in WordPress was introduced in the 2.6 release and it is a great feature. It is something similar to the Recycle Bin in Windows OS. If you click “Trash” for any item in the WordPress, it’ll be sent to the trash, instead of directly deleting it from the database. The content you trash remains in the trash box for 30 days before being permanently deleted by WordPress.

But in this article, we’ll show you how you can modify this time period. Just add following snippet to your wp-config.php file:

define('EMPTY_TRASH_DAYS', 5 ); // Empty trash every 5 days

Above snippet will automatically empty trash in 5 days. You can always set the number to 0, and get rid of it entirely.

Leave a Reply

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