WordPress is the most popular blogging platform offering flexibility to use it for other kinds of websites as well. There are lots things including Posts, pages media, images and comments. You can also install plugins for more features or use custom code to use WordPress for other things. 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 of an important article.
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.
define('EMPTY_TRASH_DAYS', 1); //Integer is the amount of days
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. If you want to keep posts in trash for next 30 days, you can set the value to 30