Comment count sync

AI-generated summary

jtbayly is experiencing issues with comment count synchronization between WordPress and Discourse. Despite successful webhook logs, the comment count in WordPress remains at zero even after comments are posted in Discourse. angus clarifies the setup and asks for clarification on expected behavior. jtbayly simplifies the issue, stating that the comment count isn’t increasing from zero. angus confirms the Sync Comment Data webhook is set up and suggests enabling verbose logging. jtbayly provides an example where the sync was successful but the comment count still shows zero. angus requests a link to an example post. After reviewing the example, angus explains that the current settings filter comments, affecting the display of the comment count. angus suggests changing the settings to display a link to the comments and disabling the moderator-liked filter. jtbayly confirms the solution works but expresses confusion about the initial assumptions. angus clarifies that displaying both the total comment count and selected replies requires a custom setup not supported out of the box, offering to revisit the issue when jtbayly is ready to implement it.

I’m having trouble that I assume is related to these errors in the WP-Discourse log:

[2025-08-14 20:28:35] comment.ERROR: sync_comments.response_error {"message":"","discourse_topic_id":"2464","wp_post_id":20434,"http_code":""}
[2025-08-14 20:36:04] comment.ERROR: sync_comments.response_error {"message":"","discourse_topic_id":"727","wp_post_id":12097,"http_code":""}

But there is no message about why it failed to sync, so I’m not sure what to do to debug this.

I just left a comment myself and I see this in the log:

[2025-08-15 18:44:39] comment.INFO: sync_comments.success {"post_id":22491}

That post now shows correctly that there is one comment up at the top of the page in the meta-data.

However, at the bottom of the page it still says “Start the discussion at …” instead of “Join the discussion” even though there is a comment now.

Anybody have any suggestions?

I do have “Only Import Moderator-Liked” selected, but I believe that should only affect which comments are displayed, not the wording or the comment count, correct?

Hey @jtbayly, thanks for the report. I’m trying to understand what you see as the issue here. Here’s what seems to be the case based on what you’ve said:

  1. Publishing posts from Wordpress to Discourse is working properly.
  2. You have the Sync Comment Data Webhook setup (is that right?).
  3. You have “Only Import Moderator Liked” enabled.
  4. You are seeing some sync comment errors in the logs.
  5. When you reply to a post published from Wordpress in Discourse you are seeing the comment count increase but you are not seeing the post appear in Wordpress.

If you ignore the logs for a moment, could you explain what you expect to happen and how the current state diverges from your expectation.

Sorry I probably over complicated my last message with details.

Generally the comment count doesn’t seem to be increasing from 0. I don’t actually display any comments on WP.

I see! Do you have the Sync Comment Data webhook setup?

Yes, I do. And I turned on “Verbose Webhook Logs” in WP-Discourse. Interestingly, since then, I’ve had no failures in the logs, but it’s still not working. Here is the most recent entry:

[2025-08-19 00:01:11] comment.INFO: sync_comments.success {"post_id":30298} 

However, take that post as an example. Post 30298 in WP has:

  1. Been posted to Discourse automatically by WP-Discourse, thus creating a topic for it.
  2. In Discourse, there has been a post created under that topic.
  3. The comment data has been sent to WP by Discourse via Webhook, and WP-Discourse logged that it was successfully received
  4. Whether logged in or not, cleared caches or not, post 30298 in WP reports zero comments.

Thoughts?

Could you link me to an example post where the logs say the comment sync succeeded?

Just a note that @jtbayly kindly shared an example with me via a PM and I’ve taken a closer look at this. @jtbayly I think what you’re seeing is expected behaviour. You have “Only Import Moderator Liked” enabled and the display of comments, including the display of the comment count, are controlled by the filter settings you apply to comments. Unless I’m mistaken, essentially what you want is:

  • No actual comments to be imported.
  • Just the comment count to display next to the link to the corresponding topic.

In which case I think the configuration you want is to set “Enable Discourse Comments” to “Display a link to the comments”. You should then disable “Only Import Moderator Liked”.

Thank you for your help, @angus. It does appear changing those settings fixed it. I guess I was confused.

Here is how I assumed it worked:

  1. Comments that were imported would display under the post in WP.
  2. Comment count would include all of the replies to a topic in Discourse.

I had that selected because eventually I was hoping to get around to actually displaying the mod-liked comments below posts. But I guess that’s not possible along with showing the total number of replies to a topic?

Hey @jtbayly, just to close the circle on this, it sounds like essentially what you want is both

  • a total count, e.g. “45 total replies”; and
  • selected replies appearing e.g. 3 mod-like replies,

to appear at once. That is indeed a custom setup that is not supported out of the box. But we could make a version of that work. To recap:

a total count, e.g. “45 total replies”

This will work out of the box, as discussed.

When you get to that stage, create a new topic in Support > WordPress and we can figure it out based on your needs then.