This article discusses how to optimize storage for WordPress post revisions.
The post revisions feature in WordPress enables you to undo changes you have made and revert to an earlier version (revision) of a post. Post revisions are saved permanently in the database whenever you save, update, or publish a post.
By default, WordPress stores an unlimited number of revisions for a post. However, it is possible to gain a performance benefit by limiting the number of post revisions stored in the database.
For example, if you do not need to recover previous version often, you can set a limit of 10 stored revisions per post. Alternatively, if you frequently revise posts and want to be able to retrieve previous versions in the future, a higher limit like 50 or 60 may be reasonable. In many cases, however, sites benefit from a lower limit of stored revisions, leading to smaller database sizes (and as a result smaller backup file sizes also).
The A2 Optimized for WordPress plugin enables you to quickly get an idea of the current post revision storage setting for your site. To do this, follow these steps:
Click the Optimization tab:
In the left sidebar, click Best Practices:
In the Best Practices section, scroll down to the Post Revisions section:
You see one of two messages:
You can quickly and easily change the number of post revisions that WordPress stores. To do this, follow these steps:
/* Add any custom values between this line and the "stop editing" line. */
Copy the following text, and then paste it into the wp-config.php file below the line you located in step 2:
define( 'WP_POST_REVISIONS', X );
Replace X in the text you pasted in step 3 with one of the following values:
You can clean out old post revisions from the database if you no longer need them. This results in a smaller database and may improve site performance. To do this, follow these steps:
In the left sidebar of phpMyAdmin, click the WordPress database. A list of tables in the database appears.
Copy and paste the following statement into the SQL query text box. Replace prefix with the table prefix for your database:
DELETE FROM prefix_posts WHERE post_type = "revision";
For more information about post revisions in WordPress, please visit https://wordpress.org/documentation/article/revisions/.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.