WC_Comments::get_products_reviews_pending_moderation_counter
Fetches (and populates if needed) the counter.
Method of the class: WC_Comments{}
No Hooks.
Returns
Int.
Usage
$result = WC_Comments::get_products_reviews_pending_moderation_counter(): int;
WC_Comments::get_products_reviews_pending_moderation_counter() WC Comments::get products reviews pending moderation counter code WC 10.8.1
public static function get_products_reviews_pending_moderation_counter(): int {
$count = wp_cache_get( self::PRODUCT_REVIEWS_PENDING_COUNT_CACHE_KEY, self::COMMENT_COUNT_CACHE_GROUP );
if ( false === $count ) {
$count = (int) get_comments(
array(
'type__in' => array( 'review', 'comment' ),
'status' => '0',
'post_type' => 'product',
'count' => true,
)
);
wp_cache_set( self::PRODUCT_REVIEWS_PENDING_COUNT_CACHE_KEY, $count, self::COMMENT_COUNT_CACHE_GROUP, DAY_IN_SECONDS );
}
return $count;
}