当我在中调用WP\\u Query with tax Query或category\\uu时,我只从请求的类别数组中的第一个类别获取帖子。
$query = new WP_Query(
array(
"tax_query" => array(
array(
"taxonomy" => "category",
"field" => "term_id",
"terms" => array(1, 2, 3)
)
),
"posts_per_page" => -1
)
);
下面是来自$query->request的sql查询:
SELECT wp_posts.*
FROM wp_posts
INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
INNER JOIN wp_term_relationships AS tt1 ON (wp_posts.ID = tt1.object_id)
INNER JOIN wp_term_relationships AS tt2 ON (wp_posts.ID = tt2.object_id)
WHERE 1=1
AND (wp_term_relationships.term_taxonomy_id IN (1,
2,
3)
AND tt1.term_taxonomy_id IN (1)
AND tt2.term_taxonomy_id IN (1))
AND wp_posts.post_type = \'post\'
AND (wp_posts.post_status = \'publish\'
OR wp_posts.post_status = \'future\'
OR wp_posts.post_status = \'draft\'
OR wp_posts.post_status = \'pending\'
OR wp_posts.post_status = \'private\')
GROUP BY wp_posts.ID
ORDER BY wp_posts.post_date DESC
结果仅列出第1类中的职位。我的问题是什么?