WC_Comments::update_comments_count_cache_on_comment_status_changepublic staticWC 1.0

Callback for 'comment_status_change' to delete the comment count cache if the comment is included in the count.

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

Хуков нет.

Возвращает

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

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

$result = WC_Comments::update_comments_count_cache_on_comment_status_change( $new_status, $old_status, $comment );
$new_status(int|строка) (обязательный)
The new comment status.
$old_status(int|строка) (обязательный)
The old comment status.
$comment(WP_Comment) (обязательный)
Comment object.

Код WC_Comments::update_comments_count_cache_on_comment_status_change() WC 9.9.5

public static function update_comments_count_cache_on_comment_status_change( $new_status, $old_status, $comment ) {
	if ( ! self::is_comment_excluded_from_wp_comment_counts( $comment ) ) {
		wp_cache_incr( 'wc_count_comments_' . $new_status, 1, self::COMMENT_COUNT_CACHE_GROUP );
		wp_cache_decr( 'wc_count_comments_' . $old_status, 1, self::COMMENT_COUNT_CACHE_GROUP );
	}
}