Skip to content

Instantly share code, notes, and snippets.

@Nolwennig
Last active April 12, 2023 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nolwennig/e09d08a2085b4a829219ee63b084abd3 to your computer and use it in GitHub Desktop.
Save Nolwennig/e09d08a2085b4a829219ee63b084abd3 to your computer and use it in GitHub Desktop.
This query deletes all post revisions that were modified more than 30 days ago from the current date. Note that this query can potentially delete a large number of revisions, so be sure to back up your data before running it.
DELETE FROM wp_posts
WHERE post_type = 'revision'
AND post_modified < DATE_SUB(NOW(), INTERVAL 30 DAY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment