WC_Comments::get_products_reviews_pending_moderation_counterpublic staticWC 1.0

Fetches (and populates if needed) the counter.

Метод класса: WC_Comments{}

Хуков нет.

Возвращает

int.

Использование

$result = WC_Comments::get_products_reviews_pending_moderation_counter(): int;

Код WC_Comments::get_products_reviews_pending_moderation_counter() WC 10.0.2

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;
}