How to debug a post on WP not receiving comments

I just noticed a post on our WP site that displayed as having no comments, but I knew that it did receive on in Discourse. I left another one on that topic, and it also failed to show up. However, there are other posts receiving comments no problem. I can’t see anything weird or special about that post.

Is there anything I can do to debug the issue?

Make sure that the comments on the post are meeting the criteria you have set on the plugin’s Commenting options tab. If it seems that the posts comments should be getting pulled to WordPress, you could debug the issue by enabling the ‘Custom Fields’ screen option for posts on your site:

When that has been done, you will see a list of post metadata at the bottom of the edit screen. Make sure that the discourse_permalink and discourse_topic_id fields match the associated Discourse topic. If these fields are not present, it is possible that the post has been unlinked from Discourse. You can re-link an unlinked post by selecting the ‘Link to Existing Topic’ radio input from the Discourse meta box.

2 Likes

Thanks,

It gets weirder. I just watched as a comment came in on a brand new post. The home page of our WP site immediately showed one comment on that post. So far, looking good. Then, clicking through to the post, the info at the top showed there being one comment.

I clicked the number of comments to scroll down to the appropriate spot on the page, but instead of saying “Join the discussion” it said “Start the discussion.” (We don’t actually display the comments, just a count of them and the link to our Discourse instance.) I figured a page refresh would fix it, but instead, when I refreshed the page, it was back to saying there were zero comments. And the home page now updated back to zero as well.

I looked at the discourse_topic_id and discourse_permalink and they are both correct. The other discourse fields don’t make much sense to me, though.

discourse_comments_count says ‘0’

This is what’s in discourse_comments_raw:

{"id":1399,"posts_count":2,"filtered_posts_count":0,"posts":[],"participants":[{"id":11,"username":"nathan","name":"Nathan ","avatar_template":"https://www.ourdiscourse.com/user_avatar/www.ourdiscourse.com/nathan/{size}/182_2.png"},{"id":103,"username":"Zak","name":"Zak","avatar_template":"https://www.ourdiscourse.com/user_avatar/www.ourdiscourse.com/zak/{size}/652_2.png"}]}

Also, I can’t figure out what discourse_post_id is supposed to be, but just looking at the 4 digit number it contains, I would have expected it to be the WP post id, but it isn’t. What is it supposed to be?

If your Discourse topic is public, can you PM me a link to it?

Do you have the WP Discourse Publish as Unlisted Topics option enabled? The difference between the posts_count and the filtered_posts_count in the discourse_comments_raw metadata suggests that there are two small action posts in the topic. There is an issue with the WP Discourse webhook refresh function when there is a discrepancy between the posts_count and the filtered_posts_count. This is something I will deal with, but I don’t think it’s related to the issue you have with a post that is not receiving comments.

For the issue with the post that is not receiving comments, do you mean that the link to its Discourse topic is not being displayed, or is the issue that the link is displaying “start the discussion” instead of “join the discussion”?

1 Like

This.

It makes sense if the comment count is zero. I wouldn’t worry about that. It’s just what stood out to me and made me refresh the page and notice the count drop down to zero again.

1 Like

Oh, and to answer your question…

No.

1 Like