【发布时间】:2019-04-03 03:46:26
【问题描述】:
你能帮我解决这个问题吗?我有一个产品列表,我想要隐藏那些在产品可见性细节上标记为隐藏的产品。这是我的代码:
$args = array(
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
// 'terms' => 'white-wines'
'terms' => $product_categories[$wc_arr_key[$wc_cat_id]]->term_id,
'visibility' => 'visible' //NOT WORKING...
)
),
'post_type' => 'product',
'orderby' => 'menu_order',
'order' => 'ASC',
);
$products = new WP_Query( $args );
if(isset($_GET['staging']) && $_GET['staging'] == "true") {
echo "<pre>" . print_r($products) . "</pre>";
}
我想显示所有标记为可见的产品。
【问题讨论】:
标签: php wordpress woocommerce product custom-taxonomy