Discourse not linking the Comments automatically under the articles

Hey!
I have the problem that discourse is not showing the comments under my articles anymore. When my article is published, it shows up in the discourse forum of our blog, but I have to link it manually in the wordpress article afterwards. Then the comments show up. But that step wasn’t needed before.

I already was writing about it here: 422 Unprocessable Content response when using ActivityPub with WP Discourse - #5 by Miasanrot

Unfortunately the solution over there wasn’t my solution and it seems to be very individual. So I opened up a new thread. Those are the three things I was asked to publish:

  1. Logs from WP Discourse, including the meta file.
  2. Logs from Discourse, in particular the error log.
  3. A list of plugins you’re using in Discourse.

Log files from WP Discourse:
This one is from today:

[2024-03-14 06:02:59] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13514,"http_code":403} 
[2024-03-14 07:14:26] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13651,"http_code":403} 
[2024-03-14 08:22:19] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13815,"http_code":403} 
[2024-03-14 08:48:21] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13638,"http_code":403} 
[2024-03-14 09:37:36] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13759,"http_code":403} 
[2024-03-14 10:55:34] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13603,"http_code":403} 
[2024-03-14 11:25:23] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13603,"http_code":403} 
[2024-03-14 12:36:28] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13944,"http_code":403} 
[2024-03-14 16:03:01] comment.ERROR: sync_comments.response_error {"message":"Forbidden","discourse_topic_id":"","wp_post_id":13977,"http_code":403}

**Here is what is included in the meta file:**

### Server ###

WordPress - 6.4.3
PHP - 8.0.26
MySQL - 8.0.30

### Active Plugins ###

Admin Columns for ACF Fields - 0.3.1
Akismet Anti-spam: Spam Protection - 5.3.1
Borlabs Cookie - Cookie Opt-in - 2.2.67
Contact Form 7 - 5.8.6
Genesis Blocks - 3.1.1
LightStart - Maintenance Mode, Coming Soon and Landing Page Builder - 2.6.9
Podigee Wordpress Quick Publish – now with Gutenberg support! - 1.3.5
Proxy Real IP - 1.1
Shariff Wrapper - 4.6.9
TablePress - 2.2.5
TablePress Extension: Responsive Tables - 1.1
Theme Test Drive - 2.9.1
User Role Editor - 4.64.1
WP-Discourse - 2.5.1
WP Import Export - 3.9.26

### WP Discourse Settings (Secrets Excluded) ###

display-subcategories - 0
allow-tags - 0
max-tags - 5
publish-as-unlisted - 0
full-post-content - 0
custom-excerpt-length - 50
add-featured-link - 0
auto-publish - 1
force-publish - 0
force-publish-max-age - 5
publish-failure-notice - 1
auto-track - 1
allowed_post_types - post
exclude_tags - 
hide-discourse-name-field - 0
discourse-username-editable - 1
direct-db-publication-flags - 0
verbose-publication-logs - 0
enable-discourse-comments - 1
comment-type - display-comments
ajax-load - 1
load-comment-css - 1
discourse-new-tab - 1
hide-wordpress-comments - 1
show-existing-comments - 1
max-comments - 50
min-replies - 1
min-score - 0
min-trust-level - 0
bypass-trust-level-score - 50
only-show-moderator-liked - 0
custom-datetime-format - 
cache-html - 1
clear-cached-comment-html - 0
verbose-comment-logs - 0
use-discourse-webhook - 1
webhook-match-old-topics - 0
use-discourse-user-webhook - 0
webhook-match-user-email - 0
enable-sso - 0
auto-create-sso-user - 0
real-name-as-discourse-name - 0
force-avatar-update - 0
redirect-without-login - 0
sso-client-enabled - 0
sso-client-login-form-change - 0
sso-client-sync-by-email - 0
sso-client-sync-logout - 0
logs-enabled - 1

I don’t know how to download or copy something from the discours error protocol, but this is a screenshot from today. 4.06 pm is nearly the time when our latest article was published (4.11 pm)

List of plugins in discourse:

Chat (deactivated), Data Explorer, Footnote, Spoiler Alert

If I should add something, let me know. Thanks in advance for your help.

Hey @Miasanrot thanks for all this detail, it’s much appreciated!

The first thing to investigate here is the 403 comment sync error in the logs, which seems related to your issue of not seeing comments. A 403 error means that WP Discourse is not able to access Discourse, probably due to an authorisation failure.

  1. On the “Connection” tab in the WP Discourse admin panel do you see a message that says “You are connected to Discourse!”?

  2. As you’re using the “Proxy Real IP - 1.1” Wordpress plugin I’m curious about the networking environment of your Wordpress and Discourse. What role is that plugin playing?

Thanks for the fast answer! Appreciated as well.

Yes it shows that I am connected. And it also seems to create something when I publish an article. In WP I sometimes see the error that the article is already embedded (think the same problem the user had in the thread I linked). So I also think that there must be a connection (and it shows in the admin panel, as I wrote).

2nd one is a bit more difficult. I overtook this blog in january and so I didn’t set up everything by my own. But I asked the previous admin about that plugin and will get back to you as soon as I have an answer.

Edit: The plugin can be deactvated he said. So I could try that in the next step?

No solution so far unfortunately. Deactivating the plugin mentioned above didn’t help

Apologies Justin, I lost track of this. The issue is most likely something specific to do with your Wordpress setup.

(emphasis is mine)

When did they stop working? Can you identify anything that changed in Wordpress when the comments stopped working? Did

  1. You update Wordpress?
  2. You update the plugin?
  3. Your theme change (or update)?

Hey Justin, just checking in here. How are you going with this issue?

Thanks for checking back!

Hard to answer, but I think that the Update of the WordPress (and php, both on the same day) could be the point where it all happened. At least I saw that problem the first time afterwards. I’m running the second newest wordpress (i think in the recent days there was published 6.5, not installed yet) and 7.4 php if I’m informed correctly.

Discourse plugin is running on 2.5.1.

Do you happen to know which version of Wordpress you upgraded from? How long had it been between upgrades? Also did you update your theme at the same time? Is your theme a “block theme”?

I hope I can answer it without misunderstanding or wrong informations. I took over this blog in January and the WP was a pretty old version. I guess 5.x, can’t tell you the exact number. It was definitely a long time between the two updates. Our theme is still the same, it’s a individual theme that was designed and coded for our page. I knew that this could cause problems when I update the page, especially as I don’t have skills in coding, but it seemed to be fine until I recognised this discourse thing.

Sorry if I can’t give you more detailed informations about it, I try my best :smiley:
Thanks again for your patience and help.

I see. That’s a significant upgrade (i.e. from Wordpress 5.x to 6.x). Would it be possible to test this out with a default Wordpress theme (any default Wordpress theme) and see if you have the same issue? I know that’s a bit of a hassle, however that is the most likely culprit here (i.e your theme). You may need to move to a Comments Block

That should be possible. I will publish an article later this day and could switch to a wp theme shortly before and see if it works.

Oh and just an addition @angus : What does block theme exactly mean? I have the block editor in WP for stuff like pages and articles, but if block theme means that I can just add blocks to design the page like I want, then it’s not a block theme. Just to clarify.

1 Like

So, I switched to the Wordpress Theme Twenty Twenty-Three, then published my article. As always it created a thread in my discourse, but as before it wasn’t connected to the comment section of the blog and I had to do that manually.

I see. Something on your site is stopping the plugin from functioning properly. If it’s not the theme, the next port of call are the other plugins you have installed.

Without having more insight into your site the only thing I can advise is that you’re going to have to try disabling them one by one and seeing if it changes the behaviour. It’s possible that one of them is not compatible with the current version of Wordpress and or PHP 8.x (the WP Discourse plugin is with both).

Again, maybe not what you wanted to hear, however with a pluggable system like Wordpress these things (i.e. plugin conflicts) are possible sources of error. At this stage, it’s worth trying to eliminate that source.

1 Like

Is it possible that somehow caching stuff in combination with the theme has to do with it? I have no clue about all that stuff but sometimes small things don’t show up on the page and after clearing the cache it works again. For example: Yesterday I linked an article manually and the comments still didn’t show up on the page. Clearing the cache helped.

Today I published an article and it automatically linked it with discourse as it should. But comments didn’t show up. So again I cleared the cache and then they were there. It’s not easy for me to understand this, but something is not right there.

Yes, caching could be playing a role in your issue. Try using the “Load Comments With Ajax” setting in the “Commenting” tab of the WP Discourse settings.

What caching solution are you using?

The Option was activated.

I’m using WP Rocket for Caching, but I installed it after seeing some problems. These problems seemed to be solved. But I can’t really tell you how the caching was working before exactly. I know that there was caching, but I don’t know the concrete solution. When I overtook the blog, I sensed some slow loading of pictures. After using WP Rocket it seems to be better for one or two months now. (The comment problem was already there before I installed it)

But in rare cases we have the problem that something is shown wrong on the page. Last week it was that the comments were missing after connecting it manually to discourse. So I cleared the cache with WP rocket and it worked again.

It looks as if I have the same or similar issue with 422 errors. Already talked with @angus that I will set up a test environment ( WP and Discourse) for testing, hopefully this weekend…

2 Likes

WP Rocket can be a real headache. It generates static copy of your content, but tries leave untouch those parts that should be dynamic, or should be static really short time. If you are lucky enough to find rule that disables caching trustfully on comments it works — but you start loose benefits what you got.

Cachingwise WordPress is… not excaly nightmare, but close. I dumped WP Rocket because it needed too much watching and my time, and works the best with quite short TTLs. I got better results using other tools (and then should be really realistic: is there any solid points to try kill a second if it needs my worktime several hours and almost every week; disabling unnecessary plugings and choosing right theme is better option).

Most of sites actually doesn’t need commenting because those get comments quite rarely and then Discourse as comment section serves other purposes. But of course it depends.

For me connection to Discourse acts as an ad. But most of my visitors are using phones and almost never scroll down enough — totally same questionmark than sidebars are.

1 Like

And which tools? Again: I’m not very used to all this technical stuff, that’s why I am here and trying to see if there is any help for the problem. The problem was there before I installed WP Rocket and it solved some of other kind of problems, but if this tool is somehow problematic at all, I’m open for other solutions.

We have up to 100 or 200 comments under our articles (in discourse to be precise), so it’s fair to say that we want them to be integrated even if a user who just wants to read the article wont scroll down there.

Out of scope in this forum, because of it matter on tuning up WordPress. Try Facebook, something like speeding up WordPress.

But you may be interested in plugins like Asset CleanUp, EWWW Image Optimizer or even Redis, if you have a lot of concurrent users. You should use at least tools by Nginx to kill as much bot traffic as possible. But any on those doesn’t help too much if the real bottle necks are theme and tons of different plugins. And bad news are you must clean up database itself every now and then.

But if WP Rocket helps that’s nice. But don’t use too long caching times. And you must black list Discourse from cache.