【发布时间】:2012-11-07 16:56:39
【问题描述】:
我的查询没有使用orderby 参数对我的帖子进行排序。
一点背景:
我在一个循环遍历“类别”ID 的自定义分类的 foreach 语句中。在该 foreach 语句中,我试图调用一个新的 WP_Query 从该 foreach 循环的每个“类别”中获取帖子。我的 args 数组如下:
$args = array(
'post_type' => 'wpsc-product',
'post_status' => 'publish',
'showposts' => -1,
'tax_query' => array(
array(
'taxonomy' => 'wpsc_product_category',
'field' => 'term_id',
'terms' => $cat_id,
),
array(
'taxonomy' => 'series',
'field' => 'slug',
'terms' => $series_name
)
),
'orderby' => 'title',
'order' => 'DESC'
);
$cat_id 和 $series_name 都是我在此 post_type 中的自定义分类法中的数组。
orderby 和 order 根本不起作用,我不知道为什么。
【问题讨论】: