I have been using WordPress as my blogging platform for years. It might be safe to assume that I started with the first initial release.
I champion for WordPress all the time and I trust it to power my silly blog. I have come to love it but it hasn’t been a smooth road. Trying to customize your site was a pain, slow, generic, and most plugins would break after you ungracefully upgraded your WordPress,
Upgrading WordPress was a dreaded task for me. It seems like it was decade ago that you had to back up your Sql database, copy down all the modification changes you made, delete your copy of WordPress and replace it with the new version, point your database to the new version, and pray that everything will work.
I’ve had some nightmares when upgrading and learned that backing up your Sql database is worthless if you don’t confirm that the database is not corrupted. That is one of the reasons that I have come to embrace the simplicity of how WordPress upgrades now. Today the process is a simple click.
A few versions ago they added an Autosave. I welcomed that feature because I write when I am watching TV. So that means a post usually takes either two 30 minute shows or a 1 hour drama for it to be completed. In the past I have written some really good posts only to get lost either because I closed my browser in error or the browser crashed.
But, I quickly encounter a problem. I have no control on how frequently or how many revision copies would be saved. No thanks to Netflix streaming of shows like Doctor Who, Torchwood, or Battlestar Galactica my post can take a whole day to complete and eventually get published.
So, I started to see multiple drafts copies by the time the post got published.
I am disappointed that WordPress does not have a simple option in the Admin section where I can state how many copies of drafts I would like to keep at any given time.
Could it be that I am the only one that doesn’t type without distractions?
Could be. But, thanks to the internet and finding others with the same problem. I found a solution.
It appears my problem can be fixed in two parts. Both, have to be done manually.
Here is what I did to fix my problem. If you have the same problem and are thinking about doing the same. I will recommend that you make a copy of the files that you have modify. Back up your database and ensure it is a good copy. I am also assuming that you already know how to edit your wp files and familiar with using PHPMyAdmin to handle your database.
The first thing is determining on how frequent you want to autosave to happen and how many drafts you want to have total. I decided on the frequency of 300 seconds (5 minutes) and a total copy of 3.
Located your wp-config.php file in your WordPress installation and located the section that reads
/** Sets up WordPress vars and included files. */
Then enter the following. You can change the secconds and number of revisions that fit your needs.
define('AUTOSAVE_INTERVAL', 300 ); // seconds
define('WP_POST_REVISIONS', 3); // number of revisions
Two lines of simple code fixes the Autodraft Revision issue.
Your done. Unless you are like me and like to keep the .SQL database as clean and small as possible. You can use PHPMyAdmin and remove the entries of the drafts that you do not want. An easier and the step I took was to delete all the Autodrafts Revision entries.
Simply execute this SQL Query in PHPMyAdmin:
DELETE FROM wp_posts WHERE post_type = "revision";
I ended up deleting 666 rows of Revision data. I guess you can say I have taken the devil our of my blog 🙂
I lowered the size of my database by almost 50% and I have not been a heavy blogger. If you blog daily and notice multiple revisions. Don’t be surprise to see your database reduce up to 80% in size.
I hope this information was helpful. If it was not. I just want to say thank you for reading it 🙂