Learn how to disable or limit WordPress revisions to improve performance and save database space. This guide provides easy steps to modify your wp-config.php file for better WordPress optimization.
WordPress revisions are a useful feature that automatically saves copies of your content each time you make a change. While this is helpful in many cases, it can also lead to a bloated database over time, especially if you’re frequently editing posts or pages. If you’re looking to either disable or limit the number of revisions in WordPress, you can easily do so by adding a few lines of code to your wp-config.php file.
In this tutorial, we’ll show you how to both disable WordPress revisions completely and how to limit the number of revisions to a specified amount.
Step 1: Open Your wp-config.php File
The first step is to locate and open your wp-config.php file. This file is located in the root directory of your WordPress installation, and it controls various important settings for your WordPress site. You can access it via FTP, your hosting control panel (such as cPanel), or directly through file management tools in your hosting dashboard.
Step 2: Disable WordPress Revisions
If you want to disable WordPress revisions entirely, simply add the following code to your wp-config.php file. This will prevent WordPress from saving any post or page revisions:
// Disable WordPress Revisions define( 'WP_POST_REVISIONS', false );
Explanation:
WP_POST_REVISIONS: This constant controls whether WordPress saves revisions for posts and pages. Setting it tofalsecompletely disables revisions.
Important: Disabling revisions means you will not be able to revert back to previous versions of your content if changes are made. Use this option with caution if you frequently update or edit content.
Step 3: Limit the Number of WordPress Revisions
If you don’t want to disable revisions completely but want to limit the number of saved revisions to avoid cluttering your database, you can set a limit by adding this line of code to your wp-config.php file:
// Limit WordPress Post Revisions - recommended settings ( minimum: 2 | maximum: 5 ) define( 'WP_POST_REVISIONS', 3 );
Explanation:
WP_POST_REVISIONS: In this case, the constant is set to3, meaning WordPress will keep up to three revisions per post or page. Any older revisions will be deleted as new revisions are saved.
Recommended Settings:
- Minimum: Set
WP_POST_REVISIONSto at least2to ensure you have backups of your most recent edits. - Maximum: Setting it to a value between
2and5is generally recommended to keep a balance between database size and revision functionality.
Why Should You Limit or Disable Revisions?
WordPress revisions can be very helpful in restoring previous versions of posts or pages. However, storing too many revisions can increase the size of your database, which can slow down your site’s performance. If you’re running a large site or frequently making changes to content, limiting or disabling revisions can help you maintain a lean and optimized database.
Key Considerations:
- Site Performance: Disabling or limiting revisions can help improve database performance, especially on sites with a high volume of content or frequent updates.
- Backup Importance: If you rely on revisions as a form of backup, consider limiting them rather than disabling them completely. Having a few revisions available can save you from losing recent changes.
- Database Size: Reducing the number of stored revisions can help keep your database from becoming unnecessarily large.
Conclusion
By adding a simple line of code to your wp-config.php file, you can easily control how WordPress handles post revisions. Whether you choose to disable them completely or limit them to a manageable number, adjusting this setting can help optimize your site’s performance and prevent unnecessary database bloat. For most users, limiting revisions to 2-5 is a good balance between functionality and performance.
Make sure to always keep a backup of your site and database before making any changes to core WordPress files like wp-config.php. This will ensure that you can easily restore your site if anything goes wrong during the process.


Fantastic blog you have here but I was curious if you knew
of any discussion boards that cover the same topics discussed here?
I’d really love to be a part of group where I
can get advice from other knowledgeable individuals that share the same interest.
If you have any suggestions, please let me know. Cheers!
I think that what you typed made a ton of sense. However, what about this?
suppose you added a little information? I mean, I don’t wish to tell you how to run your website, but what if
you added something that grabbed folk’s attention?
You ought to glance at Yahoo’s front page and see
how they create post titles to grab people to open the links.
You might try adding a video or a picture or two to get
readers interested about what you’ve written. Just my opinion, it might bring your blog a little bit more
interesting.
Thank you for the feedback, noted.
Hi! Would you mind if I share your blog with my facebook group?
There’s a lot of people that I think would really enjoy your content.
Please let me know. Thanks
Sure, it would be great. thanks
I couldn’t resist commenting. Exceptionally well written!
Thanks