wordpress数据库似乎相当直截了当,并且有非常好的文档记录:
http://codex.wordpress.org/Database_Description
在我看来,所有类别信息都存储在表中
wp_term_relationships. 因此,您应该从comments表中进行选择,将其与posts表连接,然后再与term\\u relationships表连接,以获取每个评论的类别。
类似于:
SELECT *
FROM wp_comments
WHERE comment_post_ID
IN (
SELECT c.object_id
FROM wp_terms a, wp_term_taxonomy b, wp_term_relationships c
WHERE a.name = \'my_category_slug\'
AND b.term_id = a.term_id
AND b.taxonomy = \'category\'
AND c.term_taxonomy_id = b.term_taxonomy_id
)