This article describes how to optimize the trash settings in WordPress.
The trash feature in WordPress allows you to recover posts, comments, pages, and attachments that have been deleted. By default, this recovery period is 30 days. After 30 days, WordPress permanently deletes items in the trash folder and they are gone forever.
Although the trash feature is convenient, items marked as trash take up space in the database. If your site receives heavy traffic or contains a lot of content, the amount of database space occupied by trash items could be significant, and potentially impact database performance.
To reduce the amount of time that trash items are stored in the WordPress database, reduce the recovery period from 30 days to a shorter interval. To do this, follow these steps:
define( 'EMPTY_TRASH_DAYS', X );
require_once(ABSPATH . 'wp-settings.php');
To disable the WordPress trash feature entirely, set X to 0 (zero).