这在WooCommerce 3.0中发生了变化。它不仅仅是一个meta\\u查询,现在还包括一个tax\\u查询。这些参数现在是:
$meta_query = WC()->query->get_meta_query();
$tax_query = WC()->query->get_tax_query();
$tax_query[] = array(
\'taxonomy\' => \'product_visibility\',
\'field\' => \'name\',
\'terms\' => \'featured\',
\'operator\' => \'IN\',
);
$args = array(
\'post_type\' => \'product\',
\'post_status\' => \'publish\',
\'ignore_sticky_posts\' => 1,
\'posts_per_page\' => $atts[\'per_page\'],
\'orderby\' => $atts[\'orderby\'],
\'order\' => $atts[\'order\'],
\'meta_query\' => $meta_query,
\'tax_query\' => $tax_query,
);
请参阅woocommerce/includes/class wc短代码。php