您可以使用“post\\uu not\\u in”参数。在要排除的数组中添加产品id。
$default = array(
\'post_type\' => \'product\',
\'post__not_in\' => array(2024),
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'post_status\' => \'publish\',
\'showposts\' => $numberposts
);
if( $category != \'\' ){
$term = get_term_by( \'slug\', $category, \'product_cat\' );
if( $term ) :
$term_name = $term->name;
endif;
$default[\'tax_query\'] = array(
array(
\'taxonomy\' => \'product_cat\',
\'field\' => \'slug\',
\'terms\' => $category )
);
}
$list = new WP_Query( $default );