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( 'WP_POST_REVISIONS', 5 );  Confirm the site still loads afterwards.

What this prompt does

This prompt asks your AI assistant to add one line to wp-config.php, the file that holds core settings for your site. The line, WP_POST_REVISIONS set to 5, tells WordPress to keep only five revisions of each post or page instead of an unlimited number.

Every time you save a post, WordPress can store a copy of the earlier version. On a busy editorial site that adds many rows to the database. A limit keeps the history useful and the database smaller.

The instruction to place the line above the comment saying That’s all, stop editing! matters, since settings placed below it may not take effect.

The constant is a plain PHP definition, which is why exact punctuation matters: the name, a comma, the number, then the closing bracket and semicolon. One stray character can stop the site from loading, and that is the reason for the backup.

Before you run it

Editing wp-config.php carries more risk than most changes, because a typo can take the whole site offline.

  • Take a backup first, as the prompt says, and make sure you can reach the files through your host if the site stops loading.
  • Ask your assistant to show you the exact edit before it saves.
  • Check that the constant is not already defined elsewhere in the file, since a duplicate can cause a warning.

Existing extra revisions are not deleted at once, so the limit mainly affects future saves.

What to check afterwards

  • The homepage and the admin both load without errors.
  • The line sits above the stop-editing comment, with correct quotes and a closing semicolon.
  • It appears once only in the file.
  • Edit a post several times and check that the revision count stops at the limit.
  • Nothing else in the file was changed.

Ways to adapt it

  • Pick another number: Limit revisions to 10 instead of 5.
  • Turn them off: Disable post revisions completely, and explain the downside.
  • Clear the old ones: After that, list how many old revisions are in the database and clean them out safely.

If it goes wrong

  • A white screen appears. Restore the previous wp-config.php from the backup, or remove the added line through your host’s file manager.
  • A warning about a constant already defined. Find the earlier definition and delete one of them.
  • Revisions did not drop. The limit applies as posts are saved, so older ones may remain until then.

Cleaning your database safely and a maintenance checklist put this setting in context.

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