Skip to main content

First comment approval causes incorrect comment count

Hi,

I believe I found a bug in the Require approval for first comment workflow.

I had a post with one actual published comment. After approving that user’s first comment, the post showed 2 comments, but when I opened the discussion, only 1 comment was visible.

I checked the database and found:

  • In wpfc_fcom_posts, the affected post had comments_count = 2

  • In wpfc_fcom_post_comments, that post had:

    • one row with type = comment and status = published
    • one row with type = report and status = ignored
    • the report row was associated with first_comment_approval

I then ran a query comparing comments_count against the actual number of rows where:

type = 'comment' AND status = 'published'

The affected post was the only mismatch:

comments_count = 2
actual published comments = 1

After manually updating comments_count from 2 to 1, the displayed count was correct.

This suggests the first-comment moderation/approval flow is incrementing or preserving the cached comment count incorrectly, possibly counting the moderation/report record in addition to the published comment.

I just launched my site so its still early for things, but wanted to post and see if its an issue. Thanks.

-Daniel Garcia

Shahjahan Jewel

Thanks for the insight. We will work on it and fix it. CC: Raiyan Marzan