How to Limit WordPress Post Revisions
You may have read somewhere that it is recommended to limit the WordPress post revisions number in order to optimize your WordPress installation. In this article, I will explain how to do it and why actually do it.
By default, WordPress saves your post or page whenever you update it or every 60 seconds as well when you are writing it (this revision copy is overwritten every 60 seconds). It stores all the changes that you make in your WordPress database. And if you have many posts and/or pages on your WordPress website and you also update them quite a lot, you may end up with too many revisions stored in your WordPress database.
The revisions are a great feature when you need to restore an older version of your post or page. Or when your computer crashes, you are disconnected from the Internet or if the electricity goes out because of a storm. In cases like these, the WordPress revisions may come in really handy.
So, if you have made any changes to your WP post or page, you shall see a “X Revisions” link under the Search & Visibility box in the right sidebar.
When you click on it, you will be presented with the past changes to your WordPress post (or page) and be able to restore them as well. So if anything goes wrong with your editing, WordPress has you covered.
However, in most cases it is not necessary to store all of the revisions of your website content in your database. You should be fine with e.g. just the latest 3 of them. To make your WordPress install save just the 3 of your latest revisions, you will need to add the following code to the wp-config.php file of your WP website (you will find the wp-config.php file in the root folder of your WP website):
define(‘WP_POST_REVISIONS’, 3);
Place it anywhere before the code require_once(ABSPATH . ‘wp-settings.php’); and that’s all that you need to do.
Divi Builder History
If you are using Divi (I believe you are if you read this blog), you can also use the Divi’s Editing History option by clicking on the clock icon located in the bottom Divi menu (see the screenshot below). It stores all the changes that you make in the Divi Builder while you are working on a Divi layout. You can revert back all the changes that you make within one editing session.
So this is another good feature to know about.

WordPress expert. Divi user since 2014. I blog about WordPress and Divi, my favorite WordPress theme. When I’m not working with WordPress or writing an article for this blog, I’m probably learning Italian. You can read more about me here.
You can also add the following php script to the child theme’s function page:
add_filter( ‘wp_revisions_to_keep’, ‘divi_limit_revisions’, 10, 2 );
function divi_limit_revisions( $num ) {
$num = 3;
return $num;
}
NOTE: The “3” in “$num = 3” is the number of revisions required
Thank you for the tip!