Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress automatically permanently deletes eligible posts, pages, attachments, and comments from Trash after 30 days by default. Change that retention period with the EMPTY_TRASH_DAYS constant in wp-config.php; for example, setting it to 7 keeps items for seven days before scheduled deletion.

Set WordPress to empty Trash automatically

The supported setting is EMPTY_TRASH_DAYS, documented in WordPress’s wp-config.php handbook. Add the constant to wp-config.php before the line that says That's all, stop editing! Happy blogging.:

define( 'EMPTY_TRASH_DAYS', 7 );
  1. Make a backup of wp-config.php and your database.
  2. Open the site’s wp-config.php file using your host’s file manager, SFTP, or another authorized method.
  3. Add the define() line above the stop-editing comment.
  4. Save the file. New items moved to Trash will use the configured retention period.

Replace 7 with the positive number of days you need. If the constant is absent, WordPress uses its documented default of 30 days.

How the retention period works

The period applies to each item’s time in Trash, not to a single site-wide monthly emptying date. An item trashed on Monday becomes eligible after the configured number of days have elapsed for that item. Core’s wp_scheduled_delete() function calculates a cutoff from the current time and permanently deletes trashed comments and posts of any post type that are older than that cutoff. See the function reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
  • Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.
Setting What it does Recovery window
Constant omitted Uses WordPress’s documented default. 30 days
define( 'EMPTY_TRASH_DAYS', 7 ); Permanently deletes eligible Trash items after the threshold. 7 days per item
define( 'EMPTY_TRASH_DAYS', 30 ); Explicitly keeps the standard documented period. 30 days per item
A positive custom number Sets the corresponding retention period. That number of days per item

Do not use zero unless you want Trash disabled

define( 'EMPTY_TRASH_DAYS', 0 ); does not mean “run the emptying job immediately while preserving Trash.” WordPress treats zero as disabling Trash: deletion is immediate, and users are not shown a confirmation prompt before permanent deletion. The official configuration guidance warns that this removes the recovery buffer, so use a positive value unless your workflow deliberately requires irreversible deletion.

When does Trash start emptying after you change the setting?

The new value governs scheduled cleanup after the configuration is active. It does not create one bulk emptying event at the end of a calendar period. Each item is evaluated against its own time in Trash, and the core scheduled-deletion process removes items that have exceeded the threshold.

Rank #2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
  • Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Changing from a longer period to a shorter one can make already-trashed items eligible sooner if they are older than the new cutoff. Those items still depend on the scheduled task running; editing the file alone does not guarantee that deletion occurs at a particular clock time.

If automatic deletion is not happening

Confirm the constant and its location

  • Check spelling and capitalization: it must be EMPTY_TRASH_DAYS.
  • Ensure the line is in the active site’s wp-config.php, not a backup, staging, or different installation.
  • Use a positive integer and make sure there is no second definition elsewhere that creates confusion.

Check WordPress scheduled tasks

Core cleanup relies on scheduled WordPress work. Review the site’s Cron configuration if items remain past the threshold. WordPress documents DISABLE_WP_CRON and alternative Cron arrangements in its advanced wp-config.php guide. These settings are context for investigating missed scheduled work; inspect the actual hosting and Cron setup before changing them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
  • Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Investigate plugins or custom code

If products or other content disappear at an unexpected frequency, do not assume the core setting is responsible. A WordPress.org support discussion describes isolating a site-specific conflict by testing on staging with other plugins and the theme disabled. Use that approach to identify custom deletion code or a plugin that alters Trash behavior, then re-enable components one at a time.

Choose a safe value for your workflow

Short retention (for example, seven days)

Choose this when editors rarely need recovery and you want Trash to consume less storage. The trade-off is a shorter period to restore an accidental deletion.

Rank #4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
  • Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
  • Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
  • To get set up, connect the portable hard drive to a computer for automatic recognition no software required
  • This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
  • The available storage capacity may vary.

Thirty days

This is WordPress’s documented default and gives a month-long recovery window for each item.

Longer retention

Use a larger positive number when legal review, editorial approval, or infrequent maintenance requires more time. Remember that retained media and other content can continue using storage until deletion occurs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
UnionSine 500GB Ultra Slim Portable External Hard Drive HDD-USB 3.0
  • [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
  • 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
  • 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
  • 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
  • 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.

Immediate deletion

Use zero only when your process accepts that deleted content cannot be recovered through Trash and that WordPress will not ask for a deletion confirmation.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What this setting covers

The handbook describes the constant as applying to posts, pages, attachments, and comments. The scheduled-deletion function handles comments and posts of any type that have remained in Trash beyond the configured number of days. A plugin may implement additional storage or deletion rules, so verify its documentation when behavior differs from core WordPress.

Quick Recap

SaleBestseller No. 1
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
Seagate 2TB Portable Hard Drive | USB 3.0 (STGX2000400)
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$129.99
Bestseller No. 2
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
Seagate Portable 5TB External Hard Drive HDD – USB 3.0 for PC, Mac, PS4, & Xbox - 1-Year Rescue Service (STGX5000400), Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$180.19
Bestseller No. 3
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
Seagate Portable 1TB External Hard Drive HDD – USB 3.0 for PC, Mac, PlayStation, & Xbox, 1-Year Rescue Service (STGX1000400) , Black
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$119.80
Bestseller No. 4
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
Seagate Portable 4TB External Hard Drive HDD – USB 3.0, 1-Year Rescue
This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable; The available storage capacity may vary.
$189.90

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.