1

Try 'post_status' => 'publish', that should do the trick. See https://developer.wordpress.org/reference/functions/get_post_statuses/ for more details.


1

WooCommerce provides a function for this. You should not need to query the comments and count them: add_shortcode( 'reviews_count', function() { // Make sure we're on a Product. if ( function_exists( 'is_product' ) && is_product() ) { // Get a WC_Product object for the current product. $product = ...


Only top voted, non community-wiki answers of a minimum length are eligible