您可以尝试此SQL查询以获取分类法\'mi_neighborhoods
\' 让我们POST_ID = 1304
SELECT t.*, tt.* FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON (tt.term_id = t.term_id)
INNER JOIN wp_term_relationships AS tr ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
WHERE tt.taxonomy IN (\'mi_neighborhoods\') AND tr.object_id IN (1304)
ORDER BY t.name ASC;
一般情况下,您可以通过以下功能获得:
wp_get_object_terms(1304, \'mi_neighborhoods\');
EDIT: 下面是一个查询id/name/slug
属于\'mi_neighborhoods
\' 分类法:
SELECT t.term_id, t.name, t.slug
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON (t.term_id = tt.term_id)
WHERE tt.taxonomy IN (\'mi_neighborhoods\')
ORDER BY t.name ASC
对于所有非空条款,都是一样的:
SELECT t.term_id, t.name, t.slug
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON (t.term_id = tt.term_id)
WHERE tt.taxonomy IN (\'mi_neighborhoods\') AND tt.count > 0
ORDER BY t.name ASC