404 error loading comments

I’m trying to understand why the comments arent loading, so i checked the network tab, in the browser, and there is a call to the url wp-json/wp-discourse/v1/discourse-comments?post_id=544 that returns a 404.

The blog post itself loads a div like so:
<div class="wpdc-comments-loading" id="wpdc-comments" data-post-id="544"></div>

The publish feature works without any problem.
I configured everything except the stuff in the SSO tab, in the discourse plugin menu.

1 Like

It looks like you have enabled the “Load Comments With Ajax” option. That option is found near the top of the WP Discourse Comment Settings tab. I’m not sure that it will make a difference, but could you temporarily try disabling that setting to see if you’re still getting a 404 response?

Also, make sure you are using an All Users API Key for the plugin’s API Key setting, and that you have set the Publishing Username setting to the name of the system user on your site. Unless you have changed it, that username will be system

I’m going to update the copy on the plugin’s Connection settings page to make it clear how to generate the API Key. When you create the key, you should see something like this:

Let me know if you’re still having trouble getting this to work.

2 Likes

Thanks for the help @simon, i disabled the “Load Comments With Ajax” and i noticed that there was more html being loaded in the page, for some reason some css is adding the “display: none” property, made a small fix for that and i can see the comments now.

Is there an option to post directly from the blog post to the forum thread?

1 Like

That’s great that it’s working. I’m not sure what was causing the issue with the “Load Comments With Ajax” functionality on your site. I’ll keep that setting enabled on my site for a while and lookout for issues with it.

I’m also not sure where the display: none CSS rule is coming from. Possible that is being added by your theme.

There isn’t an option to post directly from WordPress to the forum. It’s something that’s been asked for in the past though. I think it would only make sense for sites that are using WordPress as the SSO provider for Discourse, but there might be other ways to ensure that the user has the right to post on Discourse.

2 Likes