【发布时间】:2015-03-09 18:03:22
【问题描述】:
我正在尝试获取以下类别(关系 OR)中帖子的所有帖子 ID:10、11、12、13、14 具有某些额外属性。然而,我的问题在于类别。
我的 wp_query 的 args 数组如下:
$args = array(
'orderby' =>'ID',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'category__in' => array('10','11','12','13','14'),
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'joke_type',
'value' => $type,
'type' => 'CHAR',
'compare' => '='
),
array(
'key' => 'joke_rating',
'value' => 3,
'type' => 'SIGNED',
'compare' => '>='
)
),
'fields' => 'ids'
);
这只会让我从类别 10(或我在数组中首先放置的任何 ID)中获取帖子。我也试过:'category__in' => '10,11,12,13,14' 和 'category' => '10,11,12,13,14' 和 'cat' => '10,11,12,13,14' 都一样。
知道为什么会发生这种情况吗?
【问题讨论】:
标签: categories wordpress