How to automatically empty trash daily in WordPress

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.

How To Automatically Empty Trash Daily

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.

Read: 10+ WordPress Slider Plugins

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);

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.

Read:

Avoid Duplicate Content Issue By Showing Post Excerpt At Homepage
Broken Link Checker WordPress Plugin: Avoid Broken Links in Blog

advertisement

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!