How to Limit Post Revisions in WordPress?

Purpose of the Snippet

When creating content in the post editor, WordPress autosave the content. It helps to restore in case of power failure or browser crash on your computer. Similarly, WordPress also keeps tracking the changes by creating multiple revisions for the post. You can anytime compare the previous revisions and restore when needed. However, keeping too many revisions is not needed for many of us as it will increase the size of your database.

Template to Edit

You can limit the maximum number of revisions in WordPress by adding the below code snippet to your config.php file.

Code Snippet

Use the below snippet for limiting maximum of revisions to 5. You can change this number to any number as you prefer.

# Maximum 5 revisions #
define('WP_POST_REVISIONS', 5); 

Use the below code if you want to completely disable revisions.

# Disable revisions #
define('WP_POST_REVISIONS', false);

Leave a Comment