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.


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

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

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

    Thanks for this, dead simple, but dead useful!

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

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

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

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

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

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

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

    thanks man i need it :)

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

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

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

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

    thats good info

    thx

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

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

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

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

    Great tip!

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

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

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

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

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

  21. 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 remove revisions - wordpress delete page revisions - wordpress delete post revisions - wordpress remove post revisions - delete post revisions wordpress - remove post revisions wordpress - wordpress delete revision - wordpress delete old revisions - wordpress revisions delete - wordpress plugin delete post revisions - wordpress clear revisions - delete revisions wordpress - where do i delete past post revisions in wordpress - how to delete a post in wordpress - wordpress revision delete - delete revisions from wordpress database - delete wordpress database - remove wordpress revisions - how to delete post revisions in wordpress - wordpress disable revisions - wordpress clear page revisions - wordpress remove page revisions - delete wordpress revisions - delete revisions in wordpress - remove revisions wordpress - wordpress delete post revision - wordpress removing page revisions - wordpress clear post revisions - wordpress delete history - delete revision wordpress - wordpress page revisions - deleting wordpress post revisions - wordpress delete revision post - wordpress how to delete save history - remove revisions in wordpress - wordpress howto delete revision history - wordpress revisions - delete history wordpress - wordpress clear revisions - wordpress delete all post - how to delete a post on wordpress - delete post wordpress - remove revision history wordpress - wordpress purge revisions - wordpress delete database - wordpress plugin clear revisions - remove wordpress page revisions - wordpress how to delete revisions - wordpress sql query to delete pages -