Remove WordPress Revisions

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'

Site Wide Limiting of Revisions in wp-config.php:

define('WP_POST_REVISIONS', false);
//or if you want 1 revision:
define('WP_POST_REVISIONS', 1);

note that you cannot delete all inherits in the wp_post status because each attachment inherits it’s short codes from the published article. If I publish id 271, then have 3 attachments, they’ll be numbered 272, 273, 274

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.