Created
May 24, 2013 11:02
-
-
Save wokamoto/5642733 to your computer and use it in GitHub Desktop.
[WordPress] 使ってない meta 情報をテーブルから消去する SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from wp_postmeta | |
where not exists (select 'x' from wp_posts where wp_posts.ID = wp_postmeta.post_id); | |
delete from wp_comments | |
where not exists (select 'x' from wp_posts where wp_posts.ID = wp_comments.comment_post_id); | |
delete from wp_commentmeta | |
where not exists (select 'x' from wp_comments where wp_comments.comment_id = wp_commentmeta.comment_id); | |
delete from wp_usermeta | |
where not exists (select 'x' from wp_users where wp_users.ID = wp_usermeta.user_id); | |
delete from wp_term_taxonomy | |
where not exists (select 'x' from wp_terms where wp_terms.term_id = wp_term_taxonomy.term_id); | |
delete from wp_term_relationships | |
where not exists (select 'x' from wp_term_taxonomy where wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment