【发布时间】:2015-09-15 22:32:49
【问题描述】:
我像这样将 post_ids 传递给 WP_Query()
$result_post_ids = $wpdb->get_results("SELECT DISTINCT auction_id
FROM " . $wpdb->prefix . "simple_auction_log
WHERE userid = $user_id
order by date DESC" , ARRAY_N);
$args = array (
'post__in' => $result_post_ids ,
'post_type' => 'product' ,
'posts_per_page' => $limit ,
'paged' => $page ,
'tax_query' => $category_filter , //category
'orderby' => $order_by,
'order' => $order
);
$result_post_ids 数组是这样的
array (size=15)
0 => string '175' (length=3)
1 => string '148' (length=3)
2 => string '169' (length=3)
3 => string '176' (length=3)
4 => string '170' (length=3)
5 => string '205' (length=3)
6 => string '142' (length=3)
7 => string '168' (length=3)
8 => string '132' (length=3)
9 => string '173' (length=3)
10 => string '177' (length=3)
11 => string '84' (length=2)
12 => string '171' (length=3)
13 => string '128' (length=3)
14 => string '82' (length=2)
所以这是我想要查看的 id 的顺序,但是当将 $args 传递给 WP_Query() 时,会重新排序值上的帖子 id,因此他首先像这样显示带有更大值的帖子
177 , 176 , ...
但我想按键的顺序显示0 , 1 , 2 请任何帮助,提前非常感谢。
【问题讨论】: