Your prompt

Take a backup of my site, then add this to wp-config.php above the line that says “That’s all, stop editing!”: define( 'EMPTY_TRASH_DAYS', 7 );  Confirm the site still loads afterwards.

What this prompt does

This prompt asks your AI assistant to add EMPTY_TRASH_DAYS set to 7 to wp-config.php. WordPress normally keeps deleted posts, pages and comments in the trash for a default period before removing them for good. This line shortens that period to seven days.

A shorter period keeps the database tidier, and it limits how long deleted content hangs around. The trade-off is a shorter window to rescue something you deleted by mistake.

Setting the value to zero turns off the trash entirely, so deleted items are removed straight away. The prompt uses 7, which keeps a safety net.

Check the trash before you apply the setting. The setting applies to posts, pages, comments and other items that WordPress sends to the trash, so a shorter period means a shorter window for undoing an accidental deletion across all of them. Keep in mind that the default is 30 days, so seven is a deliberate tightening and not a restoration of a standard value. Choose a number that matches how quickly your team notices a mistake.

Before you run it

Core file edits deserve respect.

  • Take a backup, as instructed, and know how to reach your files through the host.
  • Check the trash for anything you still want. Items older than the new limit may be removed on the next cleanup.
  • Make sure your team knows about the shorter period.
  • Ask the assistant to show you the edit before it saves.
  • Look for an existing definition of the constant, to avoid a duplicate.

What to check afterwards

  • The homepage and admin load normally.
  • The line is above the stop-editing comment and syntax is correct.
  • It appears once only.
  • Trash a test post and confirm it can still be restored today.
  • Nothing important has been lost from the trash.

Ways to adapt it

  • Change the period: Use 14 days so my editors have more time.
  • Review first: List everything currently in the trash before applying the change.
  • Combine settings: Also limit revisions, in the same edit, after showing me both lines.

If it goes wrong

  • Something vanished that you wanted. Restore the backup and retrieve it.
  • Nothing changed. Another definition may be overriding the line, or the cleanup has not yet run.
  • A white screen. Restore the old wp-config.php.

For a broader tidy-up, try cleaning the database safely and a maintenance checklist.

← Every prompt on WPMusk

SponsoredNibWP

Stop clicking. Start telling.

Ask your AI to build pages, fix speed and nail SEO, and NibWP does it on your WordPress site in minutes.

Try NibWP.com

Get the WPMusk Sunday brief

One email a week with our newest tutorials, honest tool reviews and resources you won’t find on the blog. No spam, unsubscribe in one click.

Newsletter (Sunday brief)