获取woocommerce发布的产品数量-
$total_products = count( get_posts( array(\'post_type\' => \'product\', \'post_status\' => \'publish\', \'fields\' => \'ids\', \'posts_per_page\' => \'-1\') ) );
获取属性计数-
$total_attribute_terms = get_terms(\'pa_\'. $attribute_slug, array(\'hide_empty\' => false, \'fields\' => \'count\') );
The
$attribute_slug
可以在属性编辑页面上找到-Wp admin->Products->Attributes->单击弹出菜单
edit
(非名称)