October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Disable Post Revisions in WordPress

Learn how to disable regular WordPress post revisions, preserve autosaves, cap revision history with a number, and apply conditional policies with filters.
WorldWordPress Length7 min Posted Quest giverVGSources Team

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stop WordPress from storing regular post revisions, add this constant to wp-config.php before WordPress loads its configuration:

define( 'WP_POST_REVISIONS', false );

WordPress keeps revisions enabled, with an unlimited history, when the constant is not set. Setting it to false (or 0) removes regular revision records from future saves, but it does not turn off autosaves. If you need rollback capability without unlimited database growth, use a positive number such as 3 instead.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What disabling revisions actually changes

A revision is a stored earlier version of a post or page. WordPress can use those versions to compare edits and restore an earlier draft or published version. The WP_POST_REVISIONS constant controls how many regular revisions WordPress retains for each post.

When the constant is absent, WordPress’s documented default is to keep an infinite number of revisions. Every substantial update can therefore add another row to the database. Over time, a site with frequently edited content can accumulate a large history even when editors rarely use it.

Setting the value to false disables regular revisions. Setting it to 0 has the same documented no-revision effect. This policy applies globally unless a filter changes the result for particular posts or post types.

Autosaves are a separate mechanism. They are temporary recovery copies and do not overwrite the published version. Disabling regular revisions does not remove autosave behavior, so the editor can still recover from a browser crash or interrupted editing session in the situations WordPress supports.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Disable regular revisions step by step

1. Make a recoverable copy

Before editing a PHP configuration file, create a current backup of the site and, if possible, test the change on staging. Keep an untouched copy of wp-config.php so you can restore it immediately if a syntax error prevents the site from loading.

2. Open the correct file

Edit the site’s root wp-config.php, not the sample file and not a theme’s functions.php. The file normally sits above the wp-admin, wp-content, and wp-includes directories. Use your host’s file manager, SFTP, or another method that preserves plain-text PHP files.

3. Add the constant near the beginning

Place the line immediately below the initial comment block, before WordPress loads its configuration. The official handbook specifically recommends this early placement when the setting appears ineffective. Do not put the line after the final loading statement or inside a function.

define( 'WP_POST_REVISIONS', false );

If the file already contains a WP_POST_REVISIONS definition, edit the existing definition rather than adding a second one. A constant should be defined once; duplicate definitions can cause warnings and make it unclear which policy you intended.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Preserve valid PHP syntax

Keep the semicolon, straight quotation marks, and the surrounding PHP structure intact. The constant belongs inside the file’s opening PHP section. Do not paste Markdown fences into the file, and do not add a closing PHP tag merely to insert this setting.

5. Save, clear relevant caches, and test

Save the file, then open the WordPress editor and update a test post. The change governs future saving and pruning behavior, so it does not retroactively rewrite the site’s existing revision rows. Confirm that the editor still loads, the post updates normally, and no PHP error appears in the site’s error log.

Disable versus limit: choose the policy that fits the site

Removing regular revisions is not the only way to control database growth. A positive integer retains a bounded history while preserving rollback. The documented value semantics are:

Value Regular revisions Autosave behavior Typical result
false or 0 None Autosaves remain available; documentation describes one autosave per post Smallest regular revision footprint, no normal revision rollback
Positive integer, such as 3 That many revisions per post One autosave per user in addition to the retained revisions Bounded history with limited rollback
true or -1 Every revision Autosaves remain available Unlimited revision history, the documented default behavior when enabled

For example, this keeps three regular revisions:

define( 'WP_POST_REVISIONS', 3 );

When the post is updated again, older revisions beyond the limit are automatically deleted. The limit is per post, not a promise that the whole database will contain only three historical rows: autosaves and revisions for other posts are governed separately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When disabling is appropriate

  • Editors never use the revision browser and the site has a separate content backup process.
  • Posts are generated or updated frequently and unlimited history is creating unnecessary database growth.
  • You want the simplest global policy and accept that normal revision rollback will not be available.

When a positive limit is safer

  • Multiple people edit content and an accidental change must be recoverable.
  • Published pages are revised often and a short rollback window is valuable.
  • You want predictable storage without removing the editor’s normal revision workflow entirely.

A small limit such as three is a policy choice, not a universal optimum. Choose a number that covers the site’s realistic correction window, then verify the resulting storage and recovery workflow on staging.

Use filters for conditional or post-type-specific control

The constant is global, but developers can make retention conditional with the wp_revisions_to_keep filter. The callback receives the current number and the WP_Post object; its return value determines how many revisions WordPress keeps for that post.

add_filter( 'wp_revisions_to_keep', function ( $num, $post ) {
    if ( 'page' === $post->post_type ) {
        return 5;
    }
    return $num;
}, 10, 2 );

In this example, pages retain five revisions while other post types keep the value supplied by the existing configuration. The callback must return a numeric retention policy for every branch. Test the policy with each relevant post type before deploying it.

Post-type-specific hooks

WordPress also exposes dynamic hooks such as wp_post_revisions_to_keep and wp_page_revisions_to_keep. A post-type-specific hook overrides both the global constant and the general wp_revisions_to_keep filter. This precedence matters when a site has several snippets or plugins changing revision retention: the most specific hook can win even when the global value says something else.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where to put conditional code

Keep the filter in a maintainable, site-controlled location, such as a custom plugin or the site’s existing functionality layer, rather than scattering it through a theme that may be replaced. Avoid adding several callbacks that return conflicting values. Document the intended policy and remove obsolete callbacks when the content model changes.

Disable, limit, or filter: a practical comparison

Approach Recovery capability Database growth Configuration complexity Scope
Disable with false or 0 No regular revision browser history; autosaves remain separate Stops new regular revision accumulation Low: one constant Global by default
Limit with a positive integer Retains the selected number of rollback points Bounded per post; older excess revisions are pruned on later updates Low: one constant Global by default
Filter-based policy Can preserve history for selected types or conditions Depends on each callback’s returned value Higher: PHP callback and precedence testing Conditional or post-type-specific
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Placement and syntax problems to check

The setting appears to do nothing

  1. Open the active wp-config.php and confirm the line is present there, not only in a sample or staging copy.
  2. Check that the constant is placed near the beginning, immediately beneath the initial comment block and before WordPress loads its configuration.
  3. Search the file and your custom plugins for another definition or filter that changes the value.
  4. Remember that changing the policy does not erase revision rows that were already stored. A revision list that still shows old entries is not proof that future retention is enabled.

The site shows a PHP error after saving

Restore the backup copy first, then compare the edited line character by character. The most common repair is removing a duplicated or malformed definition and ensuring the line is inside the existing PHP section with a terminating semicolon. Make the correction on staging before trying again on production.

Editors can still recover a draft

That is expected when the recovery copy is an autosave. The constant targets regular revisions; autosaves are intentionally separate so an interrupted editing session can still be recovered without replacing published content.

Only some content types retain history

Inspect conditional code and dynamic hooks. A post-type-specific filter takes precedence over the global constant and the general filter, so one content type may legitimately have a different retention number.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What happens to revisions already in the database?

The setting controls future saving and pruning. It does not, by itself, guarantee deletion of every revision row that existed before the change. Existing records therefore require a separate cleanup decision.

Do not run an unverified SQL statement copied from a forum as a universal solution. A destructive cleanup can remove recoverable content or affect data in a customized installation. Make a full database backup, identify the site’s WordPress version and database structure, and validate any cleanup procedure in a disposable copy before considering production use. If you cannot verify the procedure, leave the historical rows in place and let the new retention policy govern subsequent updates.

Operational checklist

  • Back up the database and configuration file.
  • Decide whether losing regular rollback is acceptable; if not, choose a positive limit.
  • Add or edit WP_POST_REVISIONS only once in the active wp-config.php.
  • Place it near the start of the file, below the initial comment block.
  • Preserve PHP syntax and test on staging where possible.
  • Check for filters and post-type-specific hooks that override the global setting.
  • Update a test post and confirm the editor, autosave recovery, and expected revision behavior.
  • Treat old database rows as a separate, carefully verified maintenance task.

The Bottom Line

Use define( 'WP_POST_REVISIONS', false ); to disable regular WordPress revisions globally while leaving autosaves intact. If rollback is important, set a positive limit such as 3; use filters when different post types need different policies.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.