Limit Post Revisions Without Plugin to keep your WordPress database clean and fast. Here’s how to set a limit manually using wp-config.php or your child theme.
Step 1: Add the Post Revisions Limit Code
Add this to your wp-config.php file or your child theme’s functions.php:
if ( !defined(‘WP_POST_REVISIONS’) ) {
define(‘WP_POST_REVISIONS’, 5); // Change 5 to any number you like
}
How It Works
This line sets the maximum number of revisions WordPress will keep for each post or page, reducing database clutter.
Why Limit Post Revisions Without Plugin?
Too many post revisions clutter your database and slow down backups. Limiting them helps keep your site lean and efficient.
Common Mistake
Setting the limit to zero disables revisions completely. Be careful—this means you can’t roll back to earlier versions.
Pro Tip
Place this code in wp-config.php for a global rule that applies to every post and page on your site.
Related Snippet
If you liked this, check out my guide on disabling author archives without a plugin in WordPress.