我是wordpress的新手。任何人都可以帮助我如何使用MySQL查询获取博客Id的博客类别和关键词。
答案 0 :(得分:0)
我得到了答案。最初我对表结构感到困惑
获取类别的查询是
select name from wp_terms where term_id in(
select term_id from wp_term_taxonomy where term_taxonomy_id in(
(select term_taxonomy_id from wp_term_relationships where object_id=YOUR_BLOG_ID)) and taxonomy='category');
和标签的查询是
select name from wp_terms where term_id in(
select term_id from wp_term_taxonomy where term_taxonomy_id in(
(select term_taxonomy_id from wp_term_relationships where object_id=YOUR_BLOG_ID)) and taxonomy='post_tag');