PHPMatters Help You Better Hosting Your PHP-based Sites
How to Automatically Empty WordPress Trash for Better Website Performance

How to Automatically Empty WordPress Trash for Better Website Performance

With the demand for blogging increasing day by day, WordPress has emerged as the leading platform that provides a proper platform to the bloggers. With a huge list of features, WordPress doesn’t fail to satisfy its users in any area, whether in performance or appearance. One of the most attractive utility tools that have been included in the recent versions of WordPress is the WordPress trash tool. Although some webmasters don’t find the tool effective, there are a huge community of users who recommend using this tool because of its simplified features and benefits.

Benefits of WordPress Trash Tool

It happens on various occasions that the webmasters find some of the posts are no more useful and is just taking space on the blog. They desire to delete these posts temporarily but cannot implement it because of the absence of a delete button.

But the wait is over, for the WordPress version 2.9 has introduced a Trash button that lets the users delete the post temporarily. The tool is similar to the recycle bin where the items are stored after deleting from the desktop. Hence, the user can restore or track back the post from the Trash tool at any point of time. It is very helpful for the user who, sometimes, hits the Delete button accidentally.

WordPress Trash

How to Empty WordPress Trash Automatically

Empty WordPress TrashWith the latest update on the WordPress version, the task of emptying WordPress trash automatically has become everyone’s cup of tea. Now, the administrators can easily set a systematic way of deleting the trash so that the unwanted trash can be removed from the database after a specific point of time.

The interval between two sessions of the trash deletion automatically solely depends upon the preferences of the administrator. There are some simple steps that an administrator needs to follow in order to empty the trash automatically.

First of all, it is needed to ascertain the time gap between two Trash deletion sessions. The time can be one day, one week, ten days or one month. There is no restriction in the selection of the time interval. However, it is recommended to set a time interval of less than 30 days because the trash empties itself after 30 days by default.

Secondly, the administrator needs to go to wp-config.php file and find the following code:

empty trash code

In the above-mentioned code, an integer is the number of days. Hence, the administrator should replace the integer with the desired number of days in order to facilitate automatic cleaning of the Trash. The procedure finishes with the completion of this step.

Special Notes & Alternative

AlternativeIt should be noted that there is a solution for people who don’t like the Trash feature. These administrators can change the integer to “0” and avoid permanent deletion of the posts from the Trash menu.

As the Trash feature is available in WordPress versions higher than 2.9, the above-mentioned procedure is suitable for bloggers whose site runs on recently updated WordPress versions. Users whose websites are running on WordPress versions of 2.8 can not avail this feature from the core. However, they can avail the alternate method, i.e. using plugins for deleting Trash automatically.

There are tremendous numbers of plugins that can be used to customize the time interval for deleting the trash from the WordPress site automatically. Some of the most efficient plugins that fall into this category are Trash Emptier and RJ Quick Empty Trash. Using these plugins is as easy as any other simplified plugin for WordPress. The administrator only needs to install the plugin and customize it manually to set the automatic cleaning of Trash.

RJ Quick Empty Trash

By following and implementing some simple procedures to set automatic Trash cleaning of a WordPress site, the users can improve the performance of their blogs effectively.