How to Limit Number of WordPress Revisions

, , , , ,

By default, WordPress saves every change you make to a post or page as a revision.

While this is great for version control, it can quickly bloat your database—especially on long-form content or frequently edited pages.

In fact too many revisions can slow down your admin dashboard, cause memory issues with certain page builders (like Avada or Elementor) as well as lead to database bloat over time.

This article is a quick reference for how I automatically limited the number of stored WordPress revisions.

Limiting WordPress Revisions

To control how many revisions WordPress stores, you’ll need to edit your wp-config.php file.

Step 1: Access Your Web Server

Use FTP, cPanel File Manager, or SSH to access your WordPress root directory. Open the wp-config.php file in a text editor.

Step 2: Locate the Custom Values Section

Find this comment in the file:

/* Add any custom values between this line and the “stop editing” line. */

Step 3: Add the Revision Limit

Below that line, add the following code:

define( ‘WP_POST_REVISIONS’, 10 ); // Limits post revisions to 10

You can change 10 to any number that suits your workflow.

Optional: Add a Safety Check

To avoid conflicts with plugins or themes that may define this constant elsewhere, wrap it in a conditional:

if ( ! defined( ‘WP_POST_REVISIONS’ ) ) {
    define( ‘WP_POST_REVISIONS’, 10 );
}

 

Disable Revisions Entirely

While not recommended, if you want to completely disable revisions use:

define( ‘WP_POST_REVISIONS’, false ); // Disables all post revisions

Disabling revisions means you won’t be able to roll back changes. I recommend limiting rather than disabling them.

 

Bonus Tip: Clean Up Existing Revisions

Limiting future revisions won’t remove existing ones. To clean up old revisions:

DELETE FROM wp_posts WHERE post_type = “revision”;

Always back up your database before running queries.

 

Conclusion

I hope my article on how to limit the number of revisions WordPress keeps for pages and posts. I welcome your thoughts, questions or suggestions regarding this article.

You may support my work and future improvements by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.

Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.