您可以设置tax_query
使用NOT IN
操作人员
WP_Query( array(
\'post_type\' => \'product\',
\'posts_per_page\' => 500,
\'tax_query\' => array(
\'relation\' => \'AND\'
array(
\'taxonomy\' => \'product_cat\',
\'field\' => \'slug\',
\'terms\' => array( \'cars\' ),
),
array(
\'taxonomy\' => \'product_tag\',
\'field\' => \'slug\',
\'terms\' => array( \'whatever_tag_i_dont_need\' ),
\'operator\' => \'NOT IN\',
),
),
) )
上述人员将要求所有指定任期内的职位
cars
没有鼻涕虫的标签
whatever_tag_i_dont_need
. 还有其他比较运算符。有关更多信息,请参考以下文档:
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters