Should comments webhook update count after deleting posts/comments?

I’m using DC SSO where users are managed by WP. The forum acts as a way to comment on posts, but these posts are only visible in the forum.

I have a custom “Comment” button in WP that turns into “x comments” when there are coments in the linked topic. (It uses normal WP get_comments_number that the DC plugin hooks into.)

It works well, but I’ve just tried deleting a post and the count remains the same. The UI in the WP plugin recommends:
Events: "Post is created", "Post is updated".
Based on that, it is perhaps not supported? To decrease or recalculate post/comment count.

I’m trying to understand how you’ve set this up. Please correct me if I’m wrong:

  1. You use Publishing and DiscourseConnect feature sets of the plugin.
  2. You do (not) have “Enable Discourse Comments” enabled (?: this is unclear)
  3. You have the “Sync Comment Data” webhook enabled.
  4. You have added a custom button at the bottom of the Wordpress posts linked to Discourse that displays the count of Discourse posts on a topic. It uses the get_comments_number Wordpress filter.
  5. You want the count to be updated when posts in the linked topic are deleted.

Is that right? What else have you set up (or not)?

Yes to all except 2.

I do not have Enable Discourse Comments checked. I don’t use WP-native PHP display features at all, and this is part of a custom React UI, fed by an api va JS. The only thing I use related to comments is getting their count. Everything else is offloaded to Discourse behind a button.

Ok. I think adding delete post support to the WP Discourse topic webhook is reasonable. I’ll do that in the next version (soon). I won’t be able to support your specific custom implementation, but I’ll add support for that event.

Thanks! As long as the comment count reflects the actual current count, changed for any reason, I can take it from there.