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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745472829a4629212.html
评论列表(0条)