WordPress is the most popular blogging platform offering flexibility to use it for other kinds of websites as well. There are lots of 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 accidental 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 consumes 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 a daily basis. It will reduce your workload and also improve the load time of the blog because queries will take less time in execution.
Empty Trash Automatically in WordPress
Follow these steps:
Open wp-config.php file. It will be at the root of your WordPress installation. Now add the following code in this file.
define('EMPTY_TRASH_DAYS', 1); //Integer is the amount of days
If you want to schedule it for a 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 the trash for the next 30 days, you can set the value to 30.
Now you know how to keep the burden off and keep trach clean. This helps you in keeping the WordPress database clean and remove unwanted items.