WC_Comments::update_comments_count_cache_on_comment_status_change
Callback for 'comment_status_change' to delete the comment count cache if the comment is included in the count.
Method of the class: WC_Comments{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Comments::update_comments_count_cache_on_comment_status_change( $new_status, $old_status, $comment );
- $new_status(int|string) (required)
- The new comment status.
- $old_status(int|string) (required)
- The old comment status.
- $comment(WP_Comment) (required)
- Comment object.
WC_Comments::update_comments_count_cache_on_comment_status_change() WC Comments::update comments count cache on comment status change code WC 10.8.1
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 );
}
}