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.


18 Responses to “How to Delete Existing WordPress Post Revisions Stored/Saved”

  1. Maik
    July 2nd, 2009 23:24
    18

    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.

  2. Ewen
    March 17th, 2009 05:20
    17

    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

  3. Jusn Sebastián Echeverry
    February 22nd, 2009 05:39
    16

    ¡Muchas gracias! Fue de gran ayuda.
    Thank you soo much! It was helpful.

  4. Neil Duckett
    February 16th, 2009 16:56
    15

    Can`t for te life of me get DELETE FROM wp_posts WHERE post_type = “revision”; to work.

  5. Duality
    January 31st, 2009 23:40
    14

    thanks man i need it :)

  6. deals
    January 5th, 2009 02:05
    13

    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.

  7. David July
    January 3rd, 2009 21:43
    12

    Excellent! Thank you for this and your tip to disable the WordPress revision feature entirely.

  8. Anak Balita
    November 28th, 2008 17:22
    11

    thats good info

    thx

  9. Eliminar los post del histórico en WordPress (Post Revision) | LeegaR Blog
    November 25th, 2008 20:34
    10

    [...] 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 [...]

  10. Disable Wordpress Post Revisions « HCW
    November 24th, 2008 02:14
    9

    [...] 資料來源:Disable and Turn Off Post Revisions Tracking in WordPress 2.6 or AboveHow to Delete Existing WordPress Post Revisions Stored/Saved [...]

  11. Chlankboot
    November 17th, 2008 01:55
    8

    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'

  12. Vardis
    November 9th, 2008 22:02
    7

    Great tip!

  13. deuts
    October 27th, 2008 01:34
    6

    I don’t need the post revision feature either, as I’m the only author of my blog. Thanks for this tip.

  14. Abeon Tech
    October 23rd, 2008 21:57
    5

    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!

  15. Schusterjunge» Blogarchiv » Update auf WP 2.6.1
    September 3rd, 2008 06:55
    4

    [...] 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 [...]

  16. WordPress and how to disable post revisions - Forty Plus Two
    August 17th, 2008 17:39
    3

    [...] 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 [...]

  17. Delete Wordpress 2.6 Revisions | Andrei Neculau
    July 25th, 2008 03:51
    2

    [...] 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, [...]

  18. Disable Wordpress Post Revisions | WeiPAD
    July 23rd, 2008 04:25
    1

    [...] 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 資料表 [...]

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

wordpress delete revisions - wordpress delete post revisions - wordpress revisions - wordpress clear revisions - wordpress remove revisions - wordpress revisions delete - delete wordpress revisions - delete revisions wordpress - delete post revisions wordpress - delete wordpress post revisions - wordpress purge revisions - remove revisions wordpress - remove post revisions wordpress - wordpress delete revision - delete revision wordpress - how to delete wordpress - delete page revisions wordpress - wordpress revision delete - clear wordpress revisions - revisions wordpress - delete wordpress revision - wordpress post revisions - wordpress delete old revisions - wordpress remove revision - wordpress clear post revisions - wordpress delete posts revisions - how to delete a wordpress - wordpress where are posts stored - wordpress clear database - reset page revision wordpress - how to delete post revisions in wordpress - where are wordpress posts stored - page revisions wordpress - wordpress clear page revisions - how to delete post revision wordpress - delete all wordpress posts - how to delete post revisions wordpress - post revisions wordpress - wordpress delete versions - delete Post Revision wordpress - wordpress posr revisions - delete revisions in wordpress - how to remove revision in wordpress - speed up wordpress editing + post revisions - remove wordpress post revisions - remove post revisions on wordpress - where are the posts stored in wordpress ? - wordpress remove posted by - wordpress removing revisions - delete database wordpress -