クリップボードにコピーしました!

以下のsql文を実行することで、記事のidに紐づけられたカテゴリーのidと名前を取得することができる

updated: 2025/12/19 created: 2025/12/19

SELECT tr.object_id, tr.term_taxonomy_id, t.name FROM wp_term_relationships as tr
inner join wp_terms as t on t.term_id = tr.term_taxonomy_id
inner join wp_term_taxonomy as tt on tt.term_taxonomy_id = tr.term_taxonomy_id
where tr.term_taxonomy_id != 1
and tr.term_taxonomy_id != 3
and tr.term_taxonomy_id != 3139
and tr.term_taxonomy_id != 9637
and tr.term_taxonomy_id != 13011
and tt.taxonomy = “category”
and slug not regexp ‘.*-en$’

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

©︎ 2025-2026 todo