[wp-trac] [WordPress Trac] #55309: Incorrect post comment count after deleting comment with replies

WordPress Trac noreply at wordpress.org
Wed Jun 25 10:15:48 UTC 2025


#55309: Incorrect post comment count after deleting comment with replies
--------------------------+------------------------------
 Reporter:  jwz           |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Comments      |     Version:  5.9.1
 Severity:  normal        |  Resolution:
 Keywords:  dev-feedback  |     Focuses:
--------------------------+------------------------------

Comment (by callumbw95):

 Hi @jwz,
 I agree with @davidbaumwald here and believe there should be more
 conversation around this. I have also included a test report below to
 hopefully help increase the visibility of this ticket:

 == Bug Report
 === Description
 Deleting the parent comment still counts the child comments for a post on
 the post comment count.

 === Environment
 - WordPress: 6.9-alpha-60093-src
 - PHP: 8.4.7
 - Server: nginx/1.27.5
 - Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.4.7)
 - Browser: Chrome 137.0.0.0
 - OS: macOS
 - Theme: Twenty Seventeen 3.9
 - MU Plugins: None activated
 - Plugins:
   * Test Reports 1.2.0

 === Steps to Reproduce
 1. Add a comment to a post. (comment count: 1)
 2. Add a reply to the comment. (comment count: 2)
 3. Delete the top level comment. (comment count: 1)

 === Expected Results
 1. No comments are displayed on the front end.
 2. The comment count for the post is equal to the displayed comments on
 the post, in this case 0.

 === Actual Results
 1. No comments are displayed on the front end.
 2. The comment count displays active comments on the post, in this
 scenario 1, however should this be counting child comments to comments
 that have been deleted?

 === Additional Notes
 - Whilst from a technical perspective it makes sense to count all comments
 that are linked to the post, should we counting child comments that are
 under a deleted comment?
 - Technically what is happening now is "correct", but isn't the clearest
 as it is somewhat ambiguous, and could cause some confusion when comments
 don't show on a post.

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


More information about the wp-trac mailing list