WordPress revisions let you restore earlier versions of posts and pages. You can limit how many it retains and remove selected older revisions when their history is no longer needed.

Set a revision limit

Back up the site’s files and database before editing wp-config.php.

  1. Open the actual WordPress configuration file.

  2. Check whether WP_POST_REVISIONS is already defined.

  3. Edit that existing definition, or add one before WordPress loads its settings:

    define('WP_POST_REVISIONS', 3);
  4. Save and test editing a post.

The example retains up to three revisions per post. The retention check runs as WordPress saves revisions; adding the constant is not an immediate cleanup of the whole database.

To disable normal revision retention instead:

define('WP_POST_REVISIONS', false);

Use one definition, not both. This does not prevent editing or saving posts and does not disable the separate autosave mechanism.

Remove selected existing revisions

Use a WordPress-aware cleanup tool or WP-CLI so associated data and deletion hooks are handled by WordPress. A raw deletion from the posts table alone can leave related metadata behind.

With WP-CLI available, run as the site’s account user in the correct installation:

wp post list --post_type=revision --fields=ID,post_parent,post_date --format=table

Review the revision IDs and their parent posts. To permanently delete specific reviewed IDs, for example 123 and 124:

wp post delete 123 124 --force

Replace the example IDs with confirmed revisions, not live posts. Verify the result and check the affected posts afterwards.

Review autosave separately

AUTOSAVE_INTERVAL controls autosave timing in seconds. Do not change it merely to limit revisions; a longer interval can leave more unsaved work between saves.