我的查询没有使用该orderby
参数对我的帖子进行排序。
一点背景:
我在一个 foreach 语句中,该语句循环遍历“类别”ID 的自定义分类。在该 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
根本不工作,我不知道为什么。