Empty WordPress trash automatically

Ever since the release of version 2.9 WordPress automatically deletes posts, pages, attachments, and comments, from the trash bin every 30 days. You are able to change this default behaviour by adding a snippet of code to the wp-config.php file of your WordPress install. This can be handy if you want to empty the trash more often to save space, or if you want to disable the trash altogether.

The following snippet would empty the trash every 7 days. You can set this to whatever number works best for you or even 0 to disable the trash feature completely.


define('EMPTY_TRASH_DAYS', 7 );