我有自定义分类法,其中列出了“系列”下的术语,其中包含的帖子也出现在“media_type”下的术语中,其中 media_type 是 term_id 16。
我想按术语表中的 term_order 列对列表进行排序,但它不起作用。
我究竟做错了什么?
$q_result = $wpdb->get_col("
SELECT DISTINCT {$wpdb->terms}.name
FROM {$wpdb->terms}
INNER JOIN {$wpdb->term_taxonomy}
ON {$wpdb->term_taxonomy}.term_id = {$wpdb->terms}.term_id
INNER JOIN {$wpdb->term_relationships}
ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id
WHERE {$wpdb->term_taxonomy}.taxonomy = 'series'
AND {$wpdb->term_relationships}.object_id IN (
SELECT object_id
FROM {$wpdb->term_relationships}
INNER JOIN {$wpdb->term_taxonomy}
ON {$wpdb->term_taxonomy}.term_taxonomy_id = {$wpdb->term_relationships}.term_taxonomy_id
WHERE {$wpdb->term_taxonomy}.taxonomy = 'media_type'
AND {$wpdb->term_taxonomy}.term_id = '16'
ORDER BY {$wpdb->terms}.term_order
);"
);