我使用数组在同一页上显示所有产品和帖子:
$args = array(
'post_type' => array( 'product', 'post' ),
'posts_per_page' => 999,
'orderby' => 'meta_value_num',
'meta_key' => 'score_value',
'order' => 'DESC'
);
$custom_query = new WP_Query($args);
现在我想过滤帖子'cat' => '82,85'
和产品'product_cat' => 96
。
我已经将代码片段添加到我的代码中,但之后没有显示任何帖子或产品。
$args = array(
'post_type' => array( 'product', 'post' ),
'cat' => '82,85',
'product_cat' => 96,
'posts_per_page' => 999,
'orderby' => 'meta_value_num',
'meta_key' => 'score_value',
'order' => 'DESC'
);
$custom_query = new WP_Query($args);
我应该如何修改我的代码,这两个职位类型和所有职位和产品的类别将显示?
谢谢你的好意,
马格斯
1条答案
按热度按时间c2e8gylq1#
您可以使用tax_query来执行此操作。