pre_wp_update_comment_count_now
Filters a post's comment count before it is updated in the database.
Использование
add_filter( 'pre_wp_update_comment_count_now', 'wp_kama_pre_wp_update_comment_count_now_filter', 10, 3 ); /** * Function for `pre_wp_update_comment_count_now` filter-hook. * * @param int|null $new The new comment count. * @param int $old The old comment count. * @param int $post_id Post ID. * * @return int|null */ function wp_kama_pre_wp_update_comment_count_now_filter( $new, $old, $post_id ){ // filter... return $new; }
- $new(int|null)
- The new comment count.
По умолчанию: null - $old(int)
- The old comment count.
- $post_id(int)
- Post ID.
Список изменений
С версии 4.5.0 | Введена. |
Где вызывается хук
wp-includes/comment.php 2746
$new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id );