Change Days to Auto Empty & Delete or Disable WordPress Trash

»»»Change Days to Auto Empty & Delete or Disable WordPress Trash

When posts, pages, comments, images, files, portfolios, FAQs, products, items, custom post types or other elements that use WordPress built-in database structure to store the information are deleted, the items are sent to the Trash folder.

The ‘delete to trash’ feature, common in most operating systems, is a fail safe system in WordPress that prevents user from deleting items by accident. At any time, a WordPress user can restore the items that are in Trash folder.

By default, WordPress will keep the trash items in the database for 30 days, and then permanently delete the trash items after 30 days, and only then the trash items are removed from the database.

If you wish, you can change the number of days that WordPress waits before emptying the Trash. This tutorial guides you on how to change the auto Trash deletion delay days in WordPress.

To change the the number of days before trash is emptied, add the following code to the wp-config.php file.

define( 'EMPTY_TRASH_DAYS', 7 ); // 7 days

If you don’t want the WordPress to have the trash system, and want the delete action to permanently delete the item instantly with no way to recover the deleted item, add the following code to wp-config.php file, which disable the WordPress trash system:

define( 'EMPTY_TRASH_DAYS', 0 ); // Disable Trash and Delete Immediately

Be warned that it’s impossible to recover any accidentally deleted posts, pages, comments, images and other items when Trash bin is now available in WordPress, so disable Trash bin with care. A good alternative is to reduce number of days of waiting before WordPress automatically removes the trash from database.

By | 2017-03-25T03:58:21+00:00 March 25th, 2017|Categories: Web Publishing|Tags: |0 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.

Pin It on Pinterest

Share This

Share This

Share this post with your friends!