Loading...

How to delete trash in WordPress automatically?

How to delete trash in WordPress automatically?

WordPress trash can be deleted manually by clicking on the Empty Trash button. But you can also automate the process. This can be done using the wp-config.php file. This file can make a decision after what interval the WordPress trash needs to be cleaned. 

By default, WordPress cleans the trash after 30 days. To change this interval, open your wp-config.php file. This file is located in the root directory. 

After you have opened the file, search for the line saying;

define( ‘EMPTY_TRASH_DAYS’, 30 ); ​

You can change the number from 30 to any number. By doing so, the interval will change. For example, you can change it to 5 days by changing the number to 5.

define( ‘EMPTY_TRASH_DAYS’, 5 ); ​


In order to disable the trash, you can change the value to 0. So the code will become:

define( ‘EMPTY_TRASH_DAYS’, 0 ); ​

It is not advisable to change the value to 0 as you can lose your important entries. So change the number to a minimum value, so that the trash gets removed on a regular basis.

That's it. This is how you can delete your WordPress trash automatically.

Did you find this article useful?

Related Articles

How to add password to WordPress admin directory via cPanel ? In WordPress, you can access the WordPress admin directory by logging into your WordPress admin acco...
How to fix 500 internal server error ? There is no clear-cut solution to solve the 500 internal server error. You have to try various tips ...
How to change WordPress URL using phpMyAdmin in the DirectAdmin? The WordPress URL can be changed manually, by the use of phpMyAdmin from the DirectAdmin panel. To c...
How to set up caching for your WordPress website? With the use of Caching, your website's speed can be improved as it acts as the memory and saves som...
How to protect your Site from Brute force attacks? Hackers can upload malicious malware using brute force attacks. It can cause your site to become ina...

Categories

Website Maintenance 42
Website Maintenance Knowledge Base
SEO Services 40
SEO Services Knowledge Base
Website Design 51
Website design
Google Workspace 56
Set up Google Workspace for your team. Discover how to manage a team, migrate emails, share files, work from anywhere, and set up mobile management.
Billing 25
All type of billing information
Client Area Guide 1
Client Area Features
Delegate Access 10
Articles on Access Delegation for Third-party Platforms
Password Management 5
Password Management at Aarav Infotech India Pvt. Ltd.
WordPress 63
Knowledge base for WordPress

Shopping Cart

Your cart is empty