例如:
a = {};
b = [];
for i in range(20):
b.append(i)
a[i] = b
循环后,a的所有键都链接到相同的最终列表b [0,1,2,...,19]
。
但是,我想要的是a[0] = [0]
,a[1] = [0,1]
,a[2] = [0,1,2]
。
我不知道这是怎么了。
答案 0 :(得分:0)
// Exclude products in recently viewed products widget from "machine" product category
add_filter( 'woocommerce_recently_viewed_products_widget_query_args', 'custom_recently_viewed_products_widget_query_args', 10, 1 );
function custom_recently_viewed_products_widget_query_args( $args ) {
$args['tax_query'][] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'machine' ),
'operator' => 'NOT IN',
);
return $args;
}
希望有帮助