Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] 特定のカテゴリに属する投稿を任意のカスタム投稿タイプに変換する SQL
-- カテゴリー 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
You can’t perform that action at this time.