从PHP查询中排除标记
我在我的子主题从PHP查询中排除标记,php,wordpress,Php,Wordpress,我在我的子主题functions.php文件中编写了以下查询 目前,这项工作完全符合它的需要,但是我希望扩展此查询,以便它排除特定的标记 'post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'posts_per_page' => 10, 'tax_query' => array( array(
functions.php
文件中编写了以下查询
目前,这项工作完全符合它的需要,但是我希望扩展此查询,以便它排除特定的标记
'post_type' => 'product',
'meta_key' => 'total_sales',
'orderby' => 'meta_value_num',
'posts_per_page' => 10,
'tax_query' => array(
array(
'taxonomy' => 'product_tag',
'terms' => 492,
'field' => 'id',
),
),
);
您可以在“中使用“比较”=>“不”
'post_type' => 'product',
'meta_key' => 'total_sales',
'orderby' => 'meta_value_num',
'posts_per_page' => 10,
'tax_query' => array(
array(
'taxonomy' => 'product_tag',
'terms' => array( 492, 422 ),
'field' => 'id',
'compare' => 'NOT IN'
),
),
有用的链接