To disable regular post revisions in WordPress, add define( 'WP_POST_REVISIONS', false ); to wp-config.php before WordPress loads its configuration. The setting stops WordPress from retaining normal revision history, but it does not turn off autosaves. If you need database control without giving up rollback, use a positive limit such as 3 instead.
Antihost offers managed WordPress hosting with free migration, one-click staging and a 14-day free trial.
Choose the policy first, then edit a backed-up or staging copy of the configuration file. A placement mistake, invalid PHP, or an unnecessarily aggressive cleanup can make a site harder to recover, so the safest approach is to change retention behavior first and treat removal of old database rows as a separate task.
As an Amazon Associate I earn from qualifying purchases.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
What WP_POST_REVISIONS controls
WordPress stores a history of changes to posts and other revision-enabled content. That history lets an editor compare earlier versions and roll back after an unwanted edit. The global configuration constant is WP_POST_REVISIONS. When it is not defined, WordPress keeps revisions by default; the official developer documentation describes that default as an unlimited number of revisions.
The constant controls regular revisions and their retention policy. It is not a master switch for every background save made by WordPress. Autosaves are a separate mechanism: they do not overwrite published content and remain available as a recovery copy. Disabling regular revisions therefore reduces ordinary history without removing that safety mechanism.
#1 Best Overall
Value meanings at a glance
| Value | Regular revision behavior | Autosave behavior | Practical result |
|---|---|---|---|
true or -1 |
Stores every revision | Autosaves continue | Maximum rollback history and potentially the most database growth |
false or 0 |
Stores no regular revisions | One autosave per post remains | Smallest normal revision footprint, with autosave recovery still available |
Positive integer, such as 3 |
Retains that many revisions per post; older ones are deleted after a later update | One autosave per user is retained in addition to the stated revision count | Bounded history with a defined rollback window |
These are behavior definitions, not storage guarantees measured across every hosting environment. The actual number of rows in a database also depends on the content being edited and on other WordPress data.
Decide whether disabling is really the right policy
Disabling revisions is appropriate when the site has a deliberate reason to keep no normal revision history—for example, when database growth must be tightly bounded and editors have another review or backup process. It removes the convenient ability to restore an earlier saved version through the normal revision interface.
A cap is often the safer compromise. With define( 'WP_POST_REVISIONS', 3 );, editors retain three revisions for each post while older revisions are automatically pruned when the post is updated again. That limits accumulation without making every accidental edit irreversible.
Compare the two approaches
| Decision axis | Disable with false or 0 |
Limit with a positive integer |
|---|---|---|
| Recovery capability | No regular revision history; the autosave recovery copy remains | Rollback remains available within the chosen number of revisions |
| Database growth | Stops new regular revision rows from accumulating | Bounds regular history rather than eliminating it |
| Configuration complexity | One global constant | One global constant, or a filter for conditional rules |
| Scope | Global behavior for the installation | Global cap unless a filter applies different limits |
| Best fit | A policy that intentionally gives up normal rollback | Sites that want predictable storage and a recovery window |
Prepare before editing wp-config.php
wp-config.php is a PHP configuration file loaded early in the WordPress request. A syntax error or misplaced code can prevent the site from loading, so preparation matters more than the short code change suggests.
Rank #2
- Make a backup of the current
wp-config.phpbefore changing it. Keep the original available for restoration. - When possible, make and test the change on a staging copy first rather than on the live site.
- Use a plain-text editor that preserves PHP characters and does not add formatting or smart quotation marks.
- Decide whether the site needs a global policy or a conditional policy before adding code. A filter is more appropriate when different post types need different limits.
- Keep the setting in one clearly identifiable place. Multiple definitions make troubleshooting harder and can leave the effective value unclear.
The WordPress configuration handbook specifically notes that some installations require the constant near the beginning of wp-config.php, immediately below the initial comment block. Place the definition before the part of the file that loads WordPress, and preserve the surrounding PHP syntax.
Disable regular revisions globally
Use this exact definition when the policy is to keep no regular revisions:
Free tools Windows power users keep installed
One-click scans. No signup required.
define( 'WP_POST_REVISIONS', false );
- Open a backup or staging copy of
wp-config.php. - Find the early configuration section, immediately beneath the file’s initial comment block or another location before WordPress loads its configuration.
- Insert the definition exactly as shown. The semicolon is required, and the value is the PHP boolean
false, not a quoted word such as'false'. - Save the file without changing the rest of its PHP syntax.
- Deploy the edited file to the intended environment only after checking the file and retaining the backup.
- Create or edit a test post, save it more than once, and inspect the editor’s revision behavior. The expected policy is that normal revisions are not retained, while autosave recovery remains a separate mechanism.
Do not place the line after a PHP closing tag, inside a comment, or inside another statement. If the file has no closing tag, leave that convention unchanged rather than adding one merely for this setting.
Use a bounded number instead of disabling history
To retain a defined amount of rollback history, replace false with a positive integer. For example:
define( 'WP_POST_REVISIONS', 3 );
The number means three revisions per post. When the post is updated again, older revisions beyond that limit are automatically deleted. The limit applies to regular revisions; the autosave mechanism continues separately, and the documentation specifies one autosave per user in addition to the positive revision count.
How to choose a limit
There is no universal number that suits every editorial workflow. A small team making short, frequent edits may need only a few rollback points. A site with legal, technical, or multi-author review may need a larger window. Choose a number by asking how far back an editor realistically needs to recover, then test that workflow in staging.
Recommended Free Tools
- Use
1or2when: storage control is important and editors usually notice mistakes immediately. - Use
3or another small single-digit value when: you want a practical safety net without retaining a long edit history. - Use a larger positive value when: posts pass through several review rounds and rollback several saves back is a normal requirement.
- Use
falseor0only when: the loss of normal revision history is an intentional policy, not merely an attempt to reduce database size.
A positive integer is still a global setting when defined in wp-config.php. It does not automatically give one post type a different limit from another; use a filter for that.
Apply different limits with filters
Conditional policies use the wp_revisions_to_keep filter. It receives the current number of revisions and the WP_Post object. The number returned by the callback becomes the retention value for that post.
Rank #4
add_filter( 'wp_revisions_to_keep', function ( $num, $post ) {
if ( 'page' === $post->post_type ) {
return 5;
}
return $num;
}, 10, 2 );
In this example, pages are assigned a limit of five, while other post types keep the value that was already in effect. The callback accepts two arguments, so the final parameter 2 is important. Keep the code in a location that loads reliably for the site, and test it on staging before applying it to production.
Post-type-specific hooks
WordPress also exposes dynamic post-type filters such as wp_post_revisions_to_keep or wp_page_revisions_to_keep. The post-type-specific hook overrides both the global WP_POST_REVISIONS constant and the general wp_revisions_to_keep filter. That precedence matters when a broad setting appears correct but one content type behaves differently.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallUse a post-type-specific hook only when that narrower scope is intentional. Otherwise, a single global constant is easier to understand and maintain.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Verify that the setting is taking effect
A successful file save is not proof that WordPress is using the intended value. Verify both the file and the resulting behavior.
Best Value
- Reopen the deployed
wp-config.phpand confirm the definition exists exactly once. - Check that the value is unquoted
false,0, or a positive integer. A string that merely looks like a boolean can produce a different PHP value. - Confirm the line appears before WordPress loads its configuration and, if necessary, move it near the start of the file beneath the initial comment block.
- Review any loaded filter code. A post-type-specific filter can override both the constant and the general filter.
- Use a non-critical test post. Save it repeatedly, then check whether regular revision entries are retained according to the selected policy.
- Check recovery expectations separately: disabling regular revisions should not be interpreted as disabling autosave.
If revisions still appear
- Placement: The definition may be too late in the file. Move it to the early configuration area described above.
- Override: A general or post-type-specific filter may return a different number. Remember that the narrower post-type hook has precedence.
- Wrong file: The edited copy may not be the configuration file used by the deployed installation. Compare the staging and production paths and deployment process.
- Expectation: Changing the setting governs future saving and pruning. It does not automatically remove historical rows already stored in the database.
- Testing method: Autosaves are separate from regular revisions. Seeing an autosave recovery copy does not prove that normal revisions are being retained.
If the site shows a PHP error after the change
Restore the backed-up configuration file first so the site can load, then reapply the change carefully on staging. Check for missing semicolons, altered quotation marks, an incomplete surrounding statement, or code inserted inside a comment. Do not keep editing a live configuration file blindly when the site is unavailable.
Understand what happens to existing revisions
The constant and filters govern future saving and pruning behavior. They are not a universal command to erase every revision row already present. If you change from unlimited history to false, old rows may still exist until a separate cleanup is performed; the setting alone should not be described as a database purge.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Removing existing rows is a different operational task that requires a carefully verified procedure for the particular installation, backup, database access method, and content model. The available official material does not establish one universally safe current cleanup procedure. Avoid copying ad-hoc SQL into production on the assumption that it is harmless. Preserve a restorable backup and obtain an installation-specific, tested process before attempting historical deletion.
Operational checklist
- Define the goal: eliminate regular history or cap it.
- Choose
false/0for no regular revisions, or a positive integer for bounded rollback. - Back up
wp-config.phpand use staging when available. - Place the constant early, near the beginning of the file beneath the initial comment block, before WordPress loads its configuration.
- Preserve valid PHP syntax and avoid duplicate definitions.
- Check for general and post-type-specific filters that can override the value.
- Test repeated saves on a non-critical post.
- Explain the policy to editors so they know whether normal rollback is available.
- Treat existing database rows as a separate cleanup decision, not an automatic consequence of changing the constant.
Which configuration should you use?
Use false when the organization has consciously accepted that normal revision rollback is unavailable and wants the smallest regular revision footprint. Use a positive integer when editors still need a defined recovery window. Use filters when the answer depends on the post type or on a condition represented by the WP_Post object.
Whatever policy you choose, keep autosave expectations separate from revision expectations. Autosaves remain a recovery copy and do not overwrite published content, but they are not the same as a browsable history of every saved revision. That distinction should be part of the site’s editing and recovery documentation.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




