WC_Comments::maybe_bump_products_reviews_pending_moderation_counter
Handles wp_insert_comment processing and actualizes the counter.
Метод класса: WC_Comments{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WC_Comments::maybe_bump_products_reviews_pending_moderation_counter( $comment_id, $comment ): void;
- $comment_id(int) (обязательный)
- Comment ID.
- $comment(WP_Comment) (обязательный)
- Comment object.
Код WC_Comments::maybe_bump_products_reviews_pending_moderation_counter() WC Comments::maybe bump products reviews pending moderation counter WC 10.5.2
public static function maybe_bump_products_reviews_pending_moderation_counter( $comment_id, $comment ): void {
$needs_bump = '0' === $comment->comment_approved;
if ( $needs_bump && in_array( $comment->comment_type, array( 'review', 'comment', '' ), true ) ) {
$is_product = 'product' === get_post_type( $comment->comment_post_ID );
if ( $is_product ) {
wp_cache_incr( self::PRODUCT_REVIEWS_PENDING_COUNT_CACHE_KEY, 1, self::COMMENT_COUNT_CACHE_GROUP );
}
}
}