How it works...
WordPress provides a feature called Revisions for storing each update to a post separately in the wp_posts table. So, if we update the post 10 times, there will be 10 records in the wp_posts table for the same post containing the content on each update. This is a very useful feature for tracking changes and restoring revisions in case we need them at a later stage. However, this feature increases the size of the database with duplicate records, making the site slow.
As a solution, we have the option of limiting, disabling, or cleaning revisions. In this recipe, we are looking at the process of limiting post revisions. By default, WordPress will store unlimited revisions. So, we limited it to five by setting WP_POST_REVISIONS ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access