[wp-trac] [WordPress Trac] #34977: When updating a Comment do not call `wp_update_comment_count` if there is no related Post

WordPress Trac noreply at wordpress.org
Fri Dec 11 16:10:07 UTC 2015


#34977: When updating a Comment do not call `wp_update_comment_count` if there is
no related Post
----------------------------------------+--------------------------
 Reporter:  rachelbaker                 |       Owner:  rachelbaker
     Type:  enhancement                 |      Status:  reviewing
 Priority:  normal                      |   Milestone:  4.5
Component:  Comments                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  good-first-bug needs-patch  |     Focuses:
----------------------------------------+--------------------------
Changes (by boonebgorges):

 * keywords:  good-first-bug has-patch needs-refresh => good-first-bug
     needs-patch
 * owner:  boonebgorges => rachelbaker


Comment:

 As suggested by @rachelbaker, it probably makes more sense to put the `!
 $post_id` check into `wp_update_comment_count()` itself.
 `wp_update_comment_count_now()` already bails when the `$post_id` is
 empty, and there's no reason why we'd ever want to add `0` to the
 deferred-comment-count array.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34977#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list