我有一个属性颜色的产品.属性值为红色,蓝色和绿色.我正在尝试创建自定义搜索,但我无法获取查询以提取任何产品.
$args = array(
'post_type' => array('product'),
'post_status' => 'publish',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN',
)
),
'tax_query' => array(
array(
'taxonomy' => 'product',
'field' => 'slug',
'terms' => array('blue', 'red', 'green'),
'operator' => 'IN',
),
)
);
$products = new WP_Query( $args );
Run Code Online (Sandbox Code Playgroud)
我哪里做错了?