Buzzshare
Disable revisions

How to Disable Post Revisions in WordPress

WordPress is a great platform and the most popular on the internet with beautiful themes and plugins. WordPress also provide you a greate featured out of the box, like Post or Page revisions feature, this feature recorded every change you make in your post or page, then if your new change is not good and you want to go back to your previous one here it is Revisions feature can help you.

But in my post today, I'm not talking about how to keep this featured. What I'm going to show you is how to Disable it; you may ask me if this feature is excellent, so why disable it? Of course, people are different for some users; it might not be the option that they happy with or feel useful to them, or maybe their website hosting has limited database space, or maybe they don't like this autosave featured.

Disable revisions, it can reduce your database size and also speed up your website as well. Yeah, people love a fast website to load, no one happy to surf a slow website so by doing this make sure you know what you are doing.

Let's get started to disable revisions

Go to your Cpanel > File Manager > then go to your WordPress folder and find a file wp-config.php and add the following code:

define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', false );

The code above will disable revisions features and change Autosave value from 60 seconds to 300 seconds (5min); by doing this, it not delete your past revisions that already saved; base on Mike Schinkel he commends on ashfame blog, revisions can be removed by creating a custom PHP file then upload it to the root of your WordPress installation and when loaded in a browser will delete revisions and any related data. Mike Schinkel website.

<?php
require_once('wp-load.php');

$posts = get_posts('post_type=revision&post_status=any&numberposts=-1');
foreach($posts as $post)
{
echo "{$post->post_title}\n";
wp_delete_post($post->ID,true);
}
?>

Finally, you got your WordPress website with no Revisions and 5-minute autosave instead of every minute, but we would like to suggest you keep this feature because maybe for some reason you need the old revisions back you can call it with just a few clicks. That's it.

Nexcess store builder

Add comment