Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Example Interest Rates: Home Loan Variable: 1.89% (1.9%*) • Home Loan Fixed: 1.84% (2.11%*) • Fixed: 1.84% (2.11%*) • Variable: 1.89% (1.9%*) • Investment IO: 2.05% (4.36%*) • Investment PI: 1.58% (2.72%*)

Disabling, Deleting, and Limiting WordPress Post Revisions

Disabling, Deleting, and Limiting WordPress Post Revisions

The default post revision functionality of WordPress is quite good. It keeps every post or page revision saved so that you can revert back to a previous version if required, and it also means that posts can be compared against each other for differences - handy if you're editing somebody else's work. The funky revision feature of WordPress doesn't come without cost. The posts can, over time, take up large amounts of MySQL database storage space. Not a big problem if storage is not a problem, but it can impact upon your storage allowance if it is restricted. Additionally, a large database full of superfluous post revisions can potentially slow down queries. The server will have to process harder and for longer to retrieve results.

If disabling post revisions is important to you, you will find that there's no default WordPress option to simply turn it off. Matt Mullenweg of Automattic has said that the important feature isn't incorporated into the WordPress framework by default because they want to leave "options" to the plugin community. They'll never be able to include options by default that will please everybody - so why try? In essence, WordPress provides everything you need while the plugin repository provides everything you'll want. By releasing a minimalistic framework optimized for both speed and efficiency, users can then pick and choose any option they require by way of plugins without having default functionality they don't or won't use.

Fortunately, post revision features can be enabled with a simple line of code. With all the snippets provided below (requiring you modify wp-config.php), you'll need to include them above the line the line that says /* That's all, stop editing! Happy blogging. */.

Turn WordPress Post Revisions Off

Navigate your way to wp-config.php and open it for editing. Add this single line of code.

/* Turn Post Revisions Off */
define('WP_POST_REVISIONS', false);

An example of what the changes will look like in wp-config.php is as follows:

Disabling, Deleting, and Limiting WordPress Post Revisions

If you ever want to start keeping revisions at any stage, simply delete or comment out the line of code.

Limit The Number of WordPress Revisions

Rather than disable revisions entirely, saving a few for a quick rollback might be prudent on the change of a failure. Open up wp-config.php for editing and add this single line of code:

/* WP Limit Post Revisions*/
define('WP_POST_REVISIONS', 3);

The 3 is the number of revisions to keep.

Alter The WordPress Revision Interval

By default, WordPress will auto-save your post every 60 seconds. The feature may interfere with your writing, or cause your installation to hang with a slow or disrupted Internet connection. To extend the interval, open up wp-config.php for editing and add this single line of code:

/* WP Autosave Interval */
define('AUTOSAVE_INTERVAL', 300);

The 300 is the number of seconds between saves (5 minutes).

Removing Existing Revisions from Your WP Database

If you would like to remove existing revisions from the WordPress database, the two primary means of accomplishing this are via phpMyAdmin or via a plugin. Whatever method you use, be sure to back up your database first. Every time you play with deleting data from your database you run the risk of inadvertently screwing the pooch.

Most hosting providers will provide you with access to phpMyAdmin. It's a tool written in PHP that allows you to connect with and manipulate databases, tables and data directly. If you don't know what I'm talking about, this first method may not be right for you.

Once you log into phpMyAdmin, select the 'SQL' tab and enter the following line of code into the text box:

DELETE FROM wp_posts WHERE post_type = &quot;revision&quot;;

Now hit the Go button. It's probably best essential you backup your database before doing this.

Disabling, Deleting, and Limiting WordPress Post Revisions

Before making any change to your database, make sure you back it up.

This SQL command will delete all entries from the wp_posts table with a post_type of revision (as opposed to, say, page or post). It might be best you edit the wp-config file before deleting revisions so you don't start accumulating them again after the mass deletion.

The second option you have to assist with the mass deletion and control over revision posts is via a WordPress plugin. A good plugin is Delete-Revision , although there are a large number of others. Simply download, upload to your plugins directory, and activate.

Read more about editing wp-config.php on the WordPress website.

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Washington)

  Want to have a chat?


Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment