最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - WP_QUERY post_in problem

programmeradmin9浏览0评论

why when i using this code :

$paramss = array('post_in' => array( 760, 761) , 'post_type' => 'product');
$wc_querya = new WP_Query($paramss);

i get 5 products list and not only product with id 760,761 ?

Regards

why when i using this code :

$paramss = array('post_in' => array( 760, 761) , 'post_type' => 'product');
$wc_querya = new WP_Query($paramss);

i get 5 products list and not only product with id 760,761 ?

Regards

Share Improve this question edited Jul 22, 2020 at 4:59 Jacob Peattie 44.1k10 gold badges50 silver badges64 bronze badges asked Jul 22, 2020 at 4:40 GilGil 31 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

As documented, it's post__in, with two underscores:

$paramss = array( 'post__in' => array( 760, 761 ) , 'post_type' => 'product' );

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论