Miguel.nz

How to modify and clean up post revisions

April 10, 2016

I was wondering how to remove my post revisions while I’m still developing a website. So I ended up with the following code:

You can manage your post revisions using the following global variable:

define('WP_POST_REVISIONS', false);

You can clean up your database by the following query:

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

Thanks to this post.