Opened 3 years ago
Last modified 3 years ago
#55309 new defect (bug)
Incorrect post comment count after deleting comment with replies
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.9.1 |
Component: | Comments | Keywords: | dev-feedback |
Focuses: | Cc: |
Description
If you move a comment to the trash, and that comment has sub-comments, none of those comments are visible (which is desired) but post->comment_count is reduced by 1 rather than by the total number of comments that have now been hidden.
For example: post has 1 comment with 3 replies. Comment count is 4. Delete the first comment. Now no comments are visible but comment count is 3.
The first comment has comment_approved set to 'trash' but the other 3 comments are still '1'. Perhaps the right fix is that when trashing a comment, all of its sub-comments are also trashed explicitly rather than implicitly.
Note: See
TracTickets for help on using
tickets.
@jwz I'm going to tag this for
dev-feedback
to see if a conversation can be sparked to determine _if_ this should be done. I agree, it seems reasonable since those comments are no longer visible.In the interim, you could always filter the number of comments for each post when the count is updated by using the pre_wp_update_comment_count_now hook and checking the parent comment of each child comment's status.