【发布时间】:2018-01-31 09:22:28
【问题描述】:
我有一个带有属性颜色的产品。属性值为红色、蓝色和绿色。我正在尝试创建自定义搜索,但无法通过查询获取任何产品。
$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 );
我哪里做错了?
【问题讨论】:
标签: php wordpress woocommerce attributes product