WC_Comments::increment_comments_count_cache_on_wp_insert_commentpublic staticWC 1.0

Callback for wp_insert_comment delete the comment count cache if the comment is included in the count.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Comments::increment_comments_count_cache_on_wp_insert_comment( $comment_id, $comment );
$comment_id(int) (обязательный)
The comment ID.
$comment(WP_Comment) (обязательный)
Comment object.

Код WC_Comments::increment_comments_count_cache_on_wp_insert_comment() WC 10.0.2

public static function increment_comments_count_cache_on_wp_insert_comment( $comment_id, $comment ) {
	if ( ! self::is_comment_excluded_from_wp_comment_counts( $comment ) ) {
		$comment_status = wp_get_comment_status( $comment );
		if ( false !== $comment_status ) {
			wp_cache_incr( 'wc_count_comments_' . $comment_status, 1, self::COMMENT_COUNT_CACHE_GROUP );
		}
	}
}