Set Post Revisions to Avoid DB Bloat

Post Revisions can significantly bloat the size of your database. Here’s how to change the default unlimited number of revisions to 5, by using this hack which needs to be placed into your theme’s functions.php file.
Set the post revisions unless the constant was set in wp-config.php

if (!defined(‘WP_POST_REVISIONS’)) define(‘WP_POST_REVISIONS’, 5);

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

About Jean Galea

Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the podcast. His personal blog can be found at

Related Articles