How to remove in the wordpress database all posts revisions except the last three?

Question

here is the commonly recommended sql command for removing posts revisions and cleaning up the wp database:

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';

how can i modify it to keep let’s say the last 3 revisions ?

0
, , Matoeil 10 years 2013-09-10T07:48:22-05:00 0 Answers 83 views 0

Leave an answer

Browse
Browse