Want to know what WordPress Theme a site is using? Check Out Now!

How To Limit WordPress Post Revisions?

Do you want to limit post revisions in WordPress?

Post revisions in WordPress are one of the handiest features for website owners.

wordpress-post-revisions

WordPress saves a revision every time you edit a post or page and save it in the WordPress database. This not only costs you space but also reduces the overall speed and performance of your WordPress theme as it has to fetch all the revisions for a particular post.

Limiting the number of revisions per post seems like a legit option. But the question is how many revisions you should save? Honestly, it depends on you how many revisions you want to keep. Ideally, 3-5 revisions should be enough, but you can keep more.

Here’s the code snippet with which you can limit the number of revisions. You can replace the number ‘5’ with a number of your own choice.

/**
 * Limit the number of revisions per post.
 */
if (!defined('WP_POST_REVISIONS')) {
    define('WP_POST_REVISIONS', 5);
}

If you want to disable the post revisions in WordPress completely, you can check out “How to Disable Post Revisions in WordPress“.

Leave a Reply

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