Empty the Trash After 7 Days
Permanently removes trashed posts, pages and comments after 7 days instead of 30, keeping the database lean.
Opens WPIDE on
Code
// Days before trashed items are deleted for good (0 disables the trash entirely, so avoid it).
if ( ! defined( 'EMPTY_TRASH_DAYS' ) ) {
define( 'EMPTY_TRASH_DAYS', 7 );
}
Notes
Has no effect if EMPTY_TRASH_DAYS is already set in wp-config.php.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.