wp_update_comment_count()
Updates the comment count for post(s).
When $do_deferred is false (is by default) and the comments have been set to be deferred, the post_id will be added to a queue, which will be updated at a later date and only updated once per post ID.
If the comments have not be set up to be deferred, then the post will be updated. When $do_deferred is set to true, then all previous deferred post IDs will be updated along with the current $post_id.
No Hooks.
Return
true|false|null
. True on success, false on failure or if post with ID does not exist.
Usage
wp_update_comment_count( $post_id, $do_deferred );
- $post_id(int|null) (required)
- Post ID.
- $do_deferred(true|false)
- Whether to process previously deferred post comment counts.
Default: false
Notes
- See: wp_update_comment_count_now() For what could cause a false return value
Changelog
Since 2.1.0 | Introduced. |