WordPress – Delete Existing Post Revisions

Version: 12.1b
Revision: 44.2 Build 11

Wordpress – Delete Existing Post Revisions

Introduction:
on the 7th of June, 2009, my WordPress SQL database was accumulating like crazy. However, I didn’t noticed this, right until I checked my Control Panel. After the initial login, I clicked on my server – upload statistic. Then, I checked my SQL Database – load – queries.

Guess what? My database size had about 10 MB of “WP Post Revisions” and the file is like…big!
So, I decided to use these tricks and disable my WordPress post – revision. The process is very simple…

1.] Log into your Cpanel and backup your “wp-config.php” file. Then, add this “define” strings into your real (original) “config” file. However, you’ll need to place this code above your “database name, users and password.” But, if you add this code below these database strings, there is a high chance that you might delete your database password or username.

—Copy Source Code—

// ** Post Revision ** //
define('WP_POST_REVISIONS', false);

—End Source Code—

2.] When you’re done, please save your “wp-config.php” file and exit.

3.] Close your “FTP file manager” and direct yourself to “phpMyAdmin”.
Then, all you need to do is copy this code into the “Query”.

Warning: be sure to backup your database first, before performing any queries in phpMyAdmin.
—Copy Source Code—

delete x,y,z
from wp_posts x
left join wp_term_relationships y on (x.id = y.object_id)
left join wp_postmeta z on (x.id = z.post_id)
where x.post_type = 'revision'

—End Source Code—

4.] After this process, just relax and keep blogging!
You will also notice that your blog, it will respond faster.

Thanks for the support!

Copyrighted By Lair360

Comments are closed.