With this tutorial, we are going to guide you to automatically empty your WordPress trash daily, weekly, monthly, or disable the feature permanently.
In WordPress, there is a feature called “Trash”, which was added to the core since the 2.9 version. It’s similar to the recycle bin feature of your local windows computer. It stores all the deleted pages, posts and comments that remain in your database for next 30 days.
This feature is helpful for those users who accidentally delete their page, post or comment, and they can restore anything from the trash if needed. However, the downside to this feature is that you have to empty the trash regularly or else it will be deleted after 30 days. But, if you want to limit or disable this feature then there are a few methods that you can use.
In this method, we will use the wp-config.php file. All you need to do is open your wp-config.php file using FTP client or CPanel. This file is usually located in the same directory where wp-includes is located.
- Add the following code to the wp-config.php file for weekly trash.
// automatically empty trash weekly define( 'EMPTY_TRASH_DAYS', 7 );
- Add the following code to the wp-config.php file for daily trash.
// automatically empty trash daily define( 'EMPTY_TRASH_DAYS', 1 );
- Add the following code to the wp-config.php file for monthly trash.
// automatically empty trash monthly define( 'EMPTY_TRASH_DAYS', 30 );
You can use above the code to automatically empty your WordPress trash on daily, weekly, or monthly basis. If you want to disable the trash completely then simply place the following code into your wp-config.php file.
// disable wordpress trash completely define( 'EMPTY_TRASH_DAYS', 0 );
Other than this, there is also a WordPress plugin called Automatically Empty Thrash, which allows you to do the same task. You can set the number of days from which the trash should be automatically deleted in the plugin option of the Admin section. However, you cannot disable the feature completely.
We believe, this article was helpful for you to disable automatic empty trash feature in WordPress. You may also want to see our list of 12 most essential WordPress plugin in 2018.