Woocommerce从相关产品中排除特定类别的产品

时间:2013-08-09 16:34:55

标签: php wordpress woocommerce

我试图将内容单品页面上的相关产品中的两个特定类别(精美手表,高级珠宝)的产品排除在外。我偶然发现的最接近的想法是来自woocommerce \ template \ single-product \中名为related.php的文件中的代码:

$args = apply_filters('woocommerce_related_products_args', array(
'post_type'     => 'product',
'ignore_sticky_posts'   => 1,
'no_found_rows'     => 1,
'posts_per_page'    => $posts_per_page,
'orderby'       => $orderby,
'post__in'      => $related,
'post__not_in'      => array($product->id)
 ) );

知道如何修改此代码或我是否看错了?

1 个答案:

答案 0 :(得分:0)

你应该使用

'post__not_in'      => array($product->id)
相关问题