I haven’t set a limit to the number of revisions, which makes some of my post have more than 20 revisions, so how to delete these revisions?
By the way, I am using WPMU and have many blogs, so how to delete WordPress revisions for all my blogs?
I haven’t set a limit to the number of revisions, which makes some of my post have more than 20 revisions, so how to delete these revisions?
By the way, I am using WPMU and have many blogs, so how to delete WordPress revisions for all my blogs?
This is a much safer query to use and will remove related entries from the postmeta and term_relationship, unlike deathlocks query in his answer.
Change the {id} to the id of each blog posts table. You can combine this query to run all the post tables at once, but try this on one table first. I’ve used it many times on single WP installs.
DELETE a,b,c
FROM wp_{id}_posts a
LEFT JOIN wp_{id}_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_{id}_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type="revision"
After you run it, optimize the database in phpmyadmin.
And add this line near the top of wp-config.php to prevent future revisions:
define('WP_POST_REVISIONS', 0);
or save one revision:
define('WP_POST_REVISIONS', 1);