我在一个定制的帖子上有一个简单的WP_query,并且工作得很好:
$args = array(
'post_type' => 'post-type',
'showposts' => 2,
'location' => 'london'
);但我希望它能够查询两个位置,因此使用了一个数组:
$args = array(
'post_type' => 'post-type',
'showposts' => 2,
'location' => array('london','paris')
);但它只会在最后一个学期出现。还有别的办法让我这么做吗?
发布于 2014-03-04 04:15:43
$args = array(
'post_type' => 'post-type',
'tax_query' => array(
array(
'taxonomy' => 'location',
'field' => 'slug',
'terms' => array('london','paris')
)
)
);试试这个
https://stackoverflow.com/questions/22160611
复制相似问题