In WordPress there are many features available which are essential for blogging. Posts, media, images and commments. Everything is available. It also has a recycle-bin like feature called trash. When we delete some posts or comments, it goes to trash instead of being permanently removed. This feature is made to avoid accidentally deletion.
If there is not enough protection against SPAMS, you will get many spam comments and posts on your blog. To avoid spam, there are many plugins available. But free plugins do not work as expected. In this case, we have to delete many spam comments and posts which go to trash. But it remains in the database and consume space. So we also need to remove items from trash to free some space.
There is also a nice option in WordPress by which you can set your blog to delete all items in trash automatically on daily basis. It will reduce your work load.
Follow these steps:
Open wp-config.php file. It will be at the root of your WordPress installation. Now add following code in this file.
If you want to schedule it for week, change 1 to 7. This number is the number of days for which you want to schedule the automatic deletion of trash.