取自同一个函数:
// prior to wordpress 4.5.0
$args = array(
\'number\' => $number,
\'orderby\' => $orderby,
\'order\' => $order,
\'hide_empty\' => $hide_empty,
\'include\' => $ids
);
$product_categories = get_terms( \'product_cat\', $args );
// since wordpress 4.5.0
$args = array(
\'taxonomy\' => "product_cat",
\'number\' => $number,
\'orderby\' => $orderby,
\'order\' => $order,
\'hide_empty\' => $hide_empty,
\'include\' => $ids
);
$product_categories = get_terms($args);
将为您提供产品类别列表。容易的