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.

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

  1. Samuel
    November 16th, 2009 01:13
    22

    Thank you! Thanks to Ewen to for his wp_config entry “define(’WP_POST_REVISIONS’,6);”.
    Cheers

  2. Jane
    November 13th, 2009 06:08
    21

    I just tried this and it worked, great. Thank you. I have so many revisions it gives me a headache to look at the list on the page. And then to know that my database is storing all of that.

    I’m on Bluehost and at first couldn’t figure out where to place the command script line. So I had to experiment and here’s what I did:

    On my database page, the 2nd tab is called “SQL’. There is a field there called “Run SQL query/queries on database”. You paste the line of code in there, click “GO” and presto.

    You get to start all over with the new revisions.

  3. Steve
    October 23rd, 2009 22:31
    20

    Thanks for this, dead simple, but dead useful!

  4. How to delete WordPress post revisions | Geekality
    October 21st, 2009 05:40
    19

    [...] I found a nice little MySQL snippet to clear out all of them in a French comment to a blog post. Thought I could share it here. Especially since I then know where to find it and it won’t [...]

  5. 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.

  6. 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

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

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

  8. 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.

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

    thanks man i need it :)

  10. 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.

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

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

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

    thats good info

    thx

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

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

  15. 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'

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

    Great tip!

  17. 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.

  18. 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!

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

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

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

  22. 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 My Digital Life Comments RSS feed to receive notification of latest comments posted.

New Articles

Incoming Search Terms for the Article

wordpress delete revisions - wordpress delete post revisions - wordpress delete page revisions - wordpress remove revisions - wordpress clear revisions - delete post revisions wordpress - delete wordpress post revisions - delete revisions wordpress - wordpress remove post revisions - delete wordpress revisions - delete page revisions wordpress - wordpress disable revisions - remove wordpress revisions - remove post revisions wordpress - wordpress clear post revisions - how to delete post revisions in wordpress - how to delete page revisions in wordpress - wordpress revisions delete - wordpress remove page revisions - wordpress clear page revisions - remove revisions wordpress - wordpress delete old revisions - wordpress delete all revisions - delete revision wordpress - wordpress delete post revision - wordpress deleting post revisions - delete wordpress database - how to delete wordpress - wordpress clean revisions - Delete post revisions - wordpress delete revision - wordpress purge revisions - wordpress delete old page revisions - delete wordpress - wordpress revision delete - delete wordpress history - delete post revision wordpress - clear revisions wordpress - DELETE FROM wp_posts WHERE post_type = "revision"; - delete page revisions - wordpress delete database - wordpress trackback url - wordpress post revisions - delete post revision - wordpress remove all posts - delete revisions - delete post wordpress - wordpress deleting page revisions - wordpress purge database - wordpress delete revision posts -