In WordPress since version 2.9, the Trash feature acts like a recycle bin, letting you recover accidentally deleted posts and pages. By default, items are automatically purged after 30 days to prevent database bloat. As experienced WordPress administrators, we've streamlined countless sites by customizing this interval—here's how to automate trash emptying daily, weekly, or on your preferred schedule.
Open your wp-config.php file, usually in the root directory alongside the wp-includes folder.
define( 'EMPTY_TRASH_DAYS', 1 ); // Integer value sets the number of days
Adjust the value: 1 for daily, 7 for weekly, or any number that suits your needs. Set it to 0 to disable Trash entirely and delete items immediately. This simple tweak keeps your site lean and performant without manual intervention.