How to delete Trash in WordPress Automatically?
We receive variety of requests from customers using our WordPress Hosting service for ways to delete entries within the trash of WordPress automatically. Thus with a view to serving to them and others., here may be a easy method to achieve the task and free the space from the server.
Basically, in WordPress the wp-config.php function is responsible for controlling the time frame that the data would be control in wordpress trash. Editing of period can assist you reduce the amount of days for the data to be preserved in WordPress. This might more free you from the necessity to see the trash section before you may manually use the ‘Empty Trash’ button.
To tweak the default configuration settings in WordPress follow the below steps:
WordPress sets a default period of 30 days till data is preserved in Trash. If you view the wp-config.php file you’ll find the following
define( ‘EMPTY_TRASH_DAYS’, 30 ); // 30 days default
Editing Trash settings in WordPress
By defining the number of days for WordPress you can change the default settings to automatically delete posts in trash.
For example : After 5 days If you want the system to automatically delete entries in trash , you can edit the entry as given below :
define( ‘EMPTY_TRASH_DAYS’, 5 );
How to stop WordPress from gather posts in Trash ?
Set the number of days to zero so that the trash will be disable.
BUT, we wouldn’t suggest you to possess such a setting enabled in your WordPress installation as you’ll end-up losing vital entries that can not be retrieved incase you need it. Therefore, we suggest you to avoid keeping the value to zero.
If you need any help with making the changes, feel free to contact us via mail or live chat.