I have written the following query in my child themes functions.php
file.
Currently this works exactly as it needs to however I wish to extend this query such that it excludes specific tags.
'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',
),
),
);
You can use 'compare' => 'NOT IN'
.
'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'
),
),
USEFUL LINKS
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.