To maintain a fast and scalable server environment, you must limit WordPress post revisions. Out of the box, WordPress is designed to save a snapshot of your content almost every time you pause typing. While this is an excellent safety net for writers, it is a nightmare for database administrators.
Every time a revision or autosave triggers, WordPress writes a brand-new row to your MySQL database. Over months and years of content creation, this mechanism creates massive database bloat, severely degrading your server’s SQL query performance. By implementing a few simple directives in your wp-config.php file, you can cap these revisions, drastically reduce your database footprint, and restore backend efficiency.
The Context: How Gutenberg Bloats the wp_posts Table
The core issue stems from how the standard Gutenberg editor interacts with the database. WordPress stores all content—live pages, drafts, menu items, and revisions—inside a single database table called wp_posts.
By default, WordPress places absolutely no limit on the number of revisions it saves. If you spend three hours drafting and formatting a comprehensive technical article, the editor might save a new database row for every minor keystroke change or layout adjustment. It is entirely common for a single published article to generate 100 or more hidden revision rows in the wp_posts table.
If your website has 500 published articles, you could easily have 50,000 useless revision rows bogging down your database. When the server’s SQL engine has to sift through thousands of obsolete rows to find the actual live content, query execution times spike, causing your Time to First Byte (TTFB) to suffer globally.
The Execution: How to Limit WordPress Post Revisions
You do not need a bloated optimization plugin to fix this architectural flaw. The most efficient and permanent way to limit WordPress post revisions is to dictate the rules directly at the server level via your wp-config.php file.
Access your server via SFTP or SSH, open the wp-config.php file located in your public root directory, and add the following definitions directly above the line that reads /* That's all, stop editing! Happy publishing. */.
1. Cap the Total Revisions
To prevent infinite row generation, force WordPress to only keep a specific number of recent revisions per post. For most enterprise and publishing environments, a limit of 5 is more than enough to provide a safety net without destroying database performance.
define(‘WP_POST_REVISIONS’, 5);
With this code active, WordPress will automatically delete the oldest revision once the 6th revision is generated, keeping your database completely lean moving forward.
2. Extend the Autosave Interval
In addition to revisions, the WordPress editor fires an AJAX request to the server every 60 seconds to autosave your current progress. If you have multiple authors working in the backend simultaneously, these constant requests consume significant backend PHP bandwidth and CPU cycles.
You can modify this behavior by extending the interval. Changing the default 60 seconds to 300 seconds (5 minutes) drastically reduces the frequency of these background server hits.
define(‘AUTOSAVE_INTERVAL’, 300);
Cleaning Up Existing Database Bloat
Adding the code above prevents future bloat, but it does not retroactively clean up the thousands of revisions already sitting in your database.
Before finalizing your optimization, you should clear the existing backlog. You can run a simple SQL query directly in phpMyAdmin or your database CLI to instantly delete all old revisions:
DELETE FROM wp_posts WHERE post_type = ‘revision’;
Warning: Always take a full database backup before executing manual SQL deletion commands on a production server.

Frequently Asked Questions
[lux_faq htag="h3" open="first" style="card"]
Q:Does limiting post revisions speed up a WordPress database?
A:Yes. Limiting WordPress post revisions drastically reduces the sheer volume of rows in the wp_posts database table. A smaller database footprint allows the server’s SQL engine to execute queries faster, directly improving backend performance and TTFB.
Q:Can I disable WordPress post revisions entirely?
A:Yes. If you do not want any revisions saved at all, you can change the configuration value to false: define('WP_POST_REVISIONS', false);. However, keeping a small cap (like 3 or 5) is generally recommended in case a browser crashes during editing.
Q:Where exactly do I place the code to limit WordPress post revisions?
A:The code must be placed in the wp-config.php file, above the line that says /* That's all, stop editing! Happy publishing. */. If you place it at the absolute bottom of the file, WordPress will ignore the command and continue saving infinite revisions.
Q:How does the AUTOSAVE_INTERVAL affect server performance?
A:By default, the editor pings the server via admin-ajax.php every 60 seconds to save data. By extending this to 300 seconds, you reduce the number of PHP executions by 80% during long editing sessions, preserving valuable CPU workers for front-end visitors.
Q:Will limiting revisions delete my currently published content?
A:No. Revisions are stored as a distinct post_type in the database. Implementing a cap only affects the historical backup drafts of a post, not the active, published version your users see.
Securing Your Database Performance
Do not let hidden draft data cripple your infrastructure. By taking a proactive stance to limit WordPress post revisions and extend autosave intervals, you ensure your database remains streamlined, scalable, and fully optimized for rapid query execution. Audit your wp-config.php file today to instantly lock down your database bloat.