admin管理员组文章数量:1426810
I have a query that's stopped working since Woo 3.6 upgrade I think. I'm trying to get products in a category that are featured. Any help would be much appreciated:)
<?php
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => 4,
'orderby' => 'date',
'order' => 'DESC',
'post__in' => wc_get_featured_product_ids(),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'ID',
'terms' => intval( $cat_id )
)
)
);
$query = new WP_Query( $args );
?>
Unfortunately this code no longer works and returns nothing. But if I comment out the 'post__in' line it works but returns the latest products in that category and not the featured. Hope that makes sense.
本文标签: loopWoocommerce featured products query no longer working
版权声明:本文标题:loop - Woocommerce featured products query no longer working 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745472828a2659828.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论