Turning Off Post Revisions in WordPress

Post Revision is a WordPress feature that was introduced with WordPress version 2.6. Post revisions allowed WordPress users to go back to previous saved versions of a post. It’s a life-saving feature to those needing to roll back to a previous post.

Although this feature have saved countless individuals from potential lost work, it also can add some overhead to the database tables because it inserts a new record every time a post is saved.

I was more than curious to how much data could be saved if post revisions were deleted from the database. So, I embarked on a project to delete post revisions from my main blog, which happens to be a multi-site blog.

Prior to doing anything, I recommend that you backup your database via PHPMyAdmin. Backup all the tables. This is very important. I can’t stress this enough.

I use the instructions from Lester Chan’s article to turn off and delete post revisions. I didn’t hesitate using Lester’s instructions because he is well-known and trusted member in the WordPress community having written many valuable plugins.

Turn Off Revisions

You can turn off revisions by editing your wp-config.php file and adding the following:

define('WP_POST_REVISIONS', false);

Delete Post Revisions

You can delete post revisions from the wp_posts table by running this SQL statement from PHPMyAdmin. You may need to repeat the process if you have a multi-site blog.

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision';

Results

I have a total of 5 blogs running on my multi-site blog. Prior to deleting post revisions, my backup SQL file was 16.6MB. After deleting the post revisions, I was able to shave off 2.3MB. The file is now only 14.3MB. It doesn’t seem like a lot of saved space, although it deleted over 1000 rows.

Which brings me to the question, was it all worth it? Probably not. For the tiny amount of space saved, you are probably better off leaving post revisions alone, because you’ll never know if you need to revert to an older post. After all, it’s a nice feature to have.

Create A WordPress Page With An External Link

I stumbled on a really neat trick of creating a WordPress Page that points to an external link. Big deal! Well, it’s a big deal because I didn’t think it was going to work at all, but apparently it does. Here are some background information about WordPress Pages. A WordPress Page is a basically blog post that resides outside of the chronological order of posts. Examples of WordPress Pages are the About, Archives and Contact Pages. These Pages are usually displayed on the sidebars of countless WordPress themes. They also appear at the header of some WordPress themes as the main navigation bar.

What if you want to create a link that will point to an external link.

Here’s the trick. Create a blank WordPress Page by accessing the Dashboard > Pages > Add New. Place in the title bar the following format.

<a href=”your-external-link-here”>Your Title</a>

It’s an odd looking title to have the HTML codes included in them. Normally, HTML codes in the title bar are suppressed or are removed, but apparently it works with the current WordPress release. That’s all you have to do. Even if you add text to the Page, you will not see the Page at all because it redirects to an external link. Sort of like a hijacked page. It’s a neat trick. Works great. I use it with my Twitter Page link. See the sidebar.

You can do the same if you want to point to an internal link in the same domain. Just edit the Page’s permalink to point to your internal link.

Posting Via Email

Posting via email is one of few features used sparingly by WordPress users. Most bloggers use the Admin – Dashboard interface to publish a post. Posting via email is a feature that has been around as long as I can remember, perhaps going back as far back as version 1.5. I’ve posted on via email once before and I don’t remember any details. To this day, I don’t know why I don’t use it. I thought I give this feature another try. Why not. The advantage of posting via email is you can work on an offline article with an email client. Another advantage is sending posts from a phone.

Ok, success. I was able to send a post via email. You are reading this article as proof. Just a couple of interesting things I want to add to the original post. You need to run wp-mail.php each time you send a post. That’s each time! Well, that sucks. I was hoping this whole process would be automated. You can however, install a plugin called WP-Cron, similar to the Unix command called cron, that will run wp-mail.php every 15 minutes or so. Better yet, if you have access to your server, just add a cron job to run wp-mail.php every 15 minutes.

If you need help in setting up your WordPress to send posts via email, you can read the documentation and installation setup here.