SQL statement to delete post revisions, limit by category and date
-
Good day, all.
After a couple years with WordPress, we’ve got a substantially large and growing wp_posts table (~520MB, InnoDB) – and much of the bloat coming from post revisions. I’ve read up on how to entirely remove all post revisions either by plugin or SQL statement. However, what I’m hoping to accomplish through a SQL statement is to remove all revisions from wp_posts and associated data from wp_postmeta, excluding revisions in a particular category. An added bonus would be able to keep revisions that were created within, say, the last 3 months.
I’m no SQL wizard, so anyone information that might get me going down the right track will be greatly appreciated.
Cheers, and thanks in advance.
- The topic ‘SQL statement to delete post revisions, limit by category and date’ is closed to new replies.