不,不是这样的,因为meta_query
用于自定义字段和tax_query
用于分类。
但您可以运行两个单独的查询来获取所有符合条件的ID,然后在第三个查询中使用这些IDpost__in
. 例如:
$cat_query_args = array(
\'posts_per_page\' => -1,
\'cat\' => \'63\',
);
$meta_query_args = array(
\'posts_per_page\' => -1,
\'meta_query\' => array(
array(
\'key\' => \'placing\',
\'value\' => \'nn\',
)
)
);
$cat_query = get_posts( $cat_query_args );
$meta_query = get_posts( $meta_query_args );
$merged_posts = array_merge( $cat_query, $meta_query );
$combined_query_args = array(
\'posts_per_page\' => 6,
\'offset\' => 0,
\'post__in\' => $merged_posts
);
$combined_posts = get_posts( $combined_query_args );