title

Get rid of unused post revisions

 

Get rid of unused post revisions

11 Mai 2013, Posted by antoine in

Here comes a very handy SQL query that will delete all posts revisions instantly as well as meta associated with it. You’ve to run the following query on your WordPress database, and all revisions (as well as meta associated with it) will be deleted from your database. One important note here, be sure to make a backup of your database before you run the code.

DELETE a,b,c
FROM wp_posts a
WHERE a.post_type = 'revision'
LEFT JOIN wp_term_relationships b
ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);