Created
November 28, 2012 04:47
-
-
Save wokamoto/4159068 to your computer and use it in GitHub Desktop.
[WordPress] 特定のカテゴリに属する投稿を任意のカスタム投稿タイプに変換する SQL
This file contains hidden or 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
-- カテゴリー 4 の投稿を、カスタム投稿タイプ photo に | |
update wp_posts | |
set post_type = 'photo' | |
where post_type = 'post' | |
and exists | |
(select object_id | |
from wp_term_taxonomy as t | |
inner join wp_relationships as r on t.term_taxonomy_id = r.term_taxonomy_id | |
where t.term_id = 4 | |
and r.object_id = wp_posts.ID); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment