Post revisions is a core WordPress feature that allows us to keep different versions of a post. Once a post is updated, a new revision will be created. The default features are set to allow unlimited post revisions. Often, these post revisions affect the loading time because WordPress has to go through all posts, including revisions, to find the right data to display. As the record count increases, the speed of the query decreases. Revisions are only used when you want to compare two versions to track changes or restore to a previous version. So, we need a way to manage these revisions without letting them affect the performance of the site.
In this recipe, we are going to use built-in WordPress features to set the number of revisions to a fixed amount, allowing WordPress to automatically remove unnecessary revisions.