Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Created December 5, 2012 02:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wokamoto/4211532 to your computer and use it in GitHub Desktop.
Save wokamoto/4211532 to your computer and use it in GitHub Desktop.
[WordPress] revision とか auto-draft とか trash な post を全部削除する SQL
delete from wp_posts
where post_status in ('auto-draft', 'trash')
or post_type = 'revision';
delete from wp_postmeta
where not exists (select 'x' from wp_posts where wp_posts.ID = wp_postmeta.post_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment