How to Delete Existing WordPress Post Revisions Stored/Saved
For users who had disabled or turned off post revisions tracking or versions history feature in WordPress (added since WordPress 2.6), it is also made sense to delete and remove all existing stored post revisions and changes made on pages stored in the database in order to reduce the wp_posts table size, especially when there is already tons of revisions or changes been kept.
To delete and remove all existing post revisions entries and rows from WordPress database Posts table, simply login to MySQL command-line interface, phpMyAdmin, SQLyog or other MySQL GUI tools. Select the appropriate WordPress database (if you have more than one databases on the same server), and then issue the following command (it’s also recommended to backup the database before performing the deletion SQL statements):
DELETE FROM wp_posts WHERE post_type = "revision";
Once all post revisions related records is purged, all revision histories is deleted, and users no longer able to check the changes by phase or compare differences between versions. Thus, deletion may also been used by administrator to ensure privacy or stop authors or writers in the blog from knowing their posts have been edited.
Related Articles
- Disable and Turn Off Post Revisions Tracking in WordPress 2.6 or Above
- How To Store Every Post Revisions on Each Auto-Save in WordPress with Limit on Versions Count
- Paginating or Split WordPress Post or Page with NextPage in WordPress Not Working
- Retrieve and Get WordPress Post ID Outside the Loop as PHP Variable
- How to Change the Frequency or Interval WordPress Auto Saves An Editing Post or Page
- Adding Extra More Fields to WordPress Write/Edit Post/Page Right Column
- How to Move WordPress Blog to New Domain or Location
- Delete, Remove or Drop Oracle Stored Packages with Drop Package
- How to List and Show WordPress Posts That Comments and Pings Off (Not Allow)
- WordPress MySQL SQL Query Error in WPDB Class










































July 2nd, 2009 23:24
Nice post, but u can use the plugin Revision Delete! for this problem
. This wp plugin delete automatic all old revisions in db than older as x days.
March 17th, 2009 05:20
Here’s an easier way – add
define(’WP_POST_REVISIONS’,6);
to your wp-config.php file. change the 6 to however many revisions you want or -1 to keep them all. Wordpress will delete the surplus revisions next time you save the post / page.
http://codex.wordpress.org/Revision_Management
February 22nd, 2009 05:39
¡Muchas gracias! Fue de gran ayuda.
Thank you soo much! It was helpful.
February 16th, 2009 16:56
Can`t for te life of me get DELETE FROM wp_posts WHERE post_type = “revision”; to work.
January 31st, 2009 23:40
thanks man i need it
January 5th, 2009 02:05
Great Guide!!!
Seriously, I have one blog that is over 2 years old, that blog has seen more than it’s fair share of revisions and updates, thus the revision history was pretty clogged up. I turned this feature off, but didn’t know how to delete the history, which mean’t the mysql database was horrible!
I only noticed as I forgot my password recently (ooops!) and had to pop into phpmyadmin to reset it, whilst there, well, lets just say I am going to print off your instructions, and clear the mess up a bit! – Nice one, thanks so much for the tips!!!
JOhn.
January 3rd, 2009 21:43
Excellent! Thank you for this and your tip to disable the WordPress revision feature entirely.
November 28th, 2008 17:22
thats good info
thx
November 25th, 2008 20:34
[...] ninguna función para eliminarlas… Buscando por Internet terminé en el artículo “How to Delete Existing WordPress Post Revisions Stored/Saved” publicado en “My Digital Life” que abarcaba mi [...]
November 24th, 2008 02:14
[...] 資料來源:Disable and Turn Off Post Revisions Tracking in WordPress 2.6 or AboveHow to Delete Existing WordPress Post Revisions Stored/Saved [...]
November 17th, 2008 01:55
Salut,
Ce n’est pas suffisant, il y a deux autres tables affectees par l’autosave (wp_term_relationships et wp_postmeta), le code complet serait:
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'
November 9th, 2008 22:02
Great tip!
October 27th, 2008 01:34
I don’t need the post revision feature either, as I’m the only author of my blog. Thanks for this tip.
October 23rd, 2008 21:57
Great tip!
The revisions take up a huge amount of space when editing posts.
I installed a new skin and had to edit each post to match….. twice the database size
Thanks for this tip, very useful!
September 3rd, 2008 06:55
[...] beschränkt. Das Löschen alter Versionen ist auch nur schwer möglich über einen SQL-Befehl, der hier erklärt wird. Scheint aber auch nicht immer zu funktionieren. Eventuell hilft dieses Plugin [...]
August 17th, 2008 17:39
[...] How to Delete Existing WordPress Post Revisions Stored/Saved shows how you remove existing revision posts from your database. This entry was written by Bengt, posted on August 17, 2008 at 9:39 am, filed under Blogging and tagged WordPress. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL. Written by Bengt and published on August 17, 2008 Posted in: Blogging Tagged with: WordPress If you liked this – share it! StumbleUpon | Digg it | del.icio.us | Email this Subscribe: by RSS or email « Authentic blogging [...]
July 25th, 2008 03:51
[...] what about those revisions left in your database? Several posts look as if they found the true answer, but it’s one of those “The one who laughs last, [...]
July 23rd, 2008 04:25
[...] and Turn Off Post Revisions Tracking in WordPress 2.6 or AboveHow to Delete Existing WordPress Post Revisions Stored/Saved Ctrl-z [↩]Post Revision 資料是寫入 wp_posts 資料表 [...]