Your prompt

Delete all spam comments, limit post revisions to 5, empty the trash after 7 days, and close comments on posts older than 90 days.

What this prompt does

This prompt cleans up four things that quietly accumulate: spam comments, old post revisions, the trash, and discussion on old posts. It deletes all spam comments, limits revisions to 5, empties the trash after 7 days, and closes comments on posts older than 90 days.

The comment closing is a core feature: Settings > Discussion has an option to close comments after a set number of days. Revision limits and the trash period are controlled by settings in wp-config.php, so your assistant may need to edit that file or use a plugin.

Deleting spam is permanent, so it is worth a short pause before you approve.

The four jobs have different permanence. Deleting spam and emptying the trash cannot be reversed, while the revision limit and comment closing are settings you can change back at any time. If you run a shop or a community, decide before you start whether product reviews should be treated differently from ordinary blog comments.

Before you run it

  • Take a backup, especially of the database.
  • Look at the spam folder first. Genuine comments sometimes get caught there.
  • Know that limiting revisions does not bring back deleted ones, and older ones are removed as posts are saved.
  • Closing comments after 90 days will stop new replies on old posts, which may be unwelcome for evergreen articles.
  • If the assistant edits wp-config.php, ask it to show you the exact lines first.

Decide whether any posts, such as popular guides, should stay open.

What to check afterwards

  • The Comments screen shows an empty spam folder.
  • Discussion settings show comments closing after 90 days.
  • Configuration shows the revision limit and trash period you asked for.
  • An old post no longer shows a comment form, while a recent one still does.
  • The site loads normally after any wp-config.php edit.

Ways to adapt it

  • Be softer: Move spam to the trash rather than deleting it, so I can review it.
  • Change the window: Close comments after 180 days instead.
  • Add a guard: Install an anti-spam tool so the spam does not return.

If it goes wrong

  • The site shows a white screen after a config edit. Restore the previous wp-config.php from your backup.
  • A real comment was lost. Recover it from the backup.
  • Spam keeps coming. Add a spam filter and consider requiring moderation for first-time commenters.

How to stop WordPress spam covers prevention, and cleaning your database safely covers the clean-up side.

← 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)