WC_Comments::increment_comments_count_cache_on_wp_insert_comment
Callback for wp_insert_comment 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::increment_comments_count_cache_on_wp_insert_comment( $comment_id, $comment );
- $comment_id(int) (required)
- The comment ID.
- $comment(WP_Comment) (required)
- Comment object.
WC_Comments::increment_comments_count_cache_on_wp_insert_comment() WC Comments::increment comments count cache on wp insert comment code WC 10.8.1
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 );
}
}
}