This error means the Webhook Secret Key option value in WP-Discourse doesn’t match the password defined in your Discourse webhook. Can you check it?
@simon will correct me if I’m wrong, but yes, a WP post needs to be synced to a Discourse topic. For existing topics, you should have the option to link to an existing Discourse topic:
.
Once synced, the comments should be retrieved.
I’m not sure if there is a better way; hopefully, some can provide better insights.
@Jane_Jojo, try linking an existing Discourse topic to its corresponding WordPress post using the method that @Arkshine demonstrated. Note that the user interface is slightly different depending on whether you’re using the Classic WordPress editor or the new Block editor.
If linking Discourse topic to a WordPress post works, the next thing to figure out will be how to link all of your existing topics and posts. How many old posts do you have? If it’s too many posts to link to Discourse manually, there might be a way to automate the process.
The error message you are seeing will be generated if you “ping” the webhook. On the WordPress end, the code is expecting there to be a post object in the webhook that’s sent from Discourse. The post will not be in the payload if you just click the “ping” button. Try leaving a comment on a Discourse topic that’s linked to Discourse and see if that still gives you an error.
For the issue of getting Discourse comments to appear on your WordPress site:
make sure that comments are enabled on WordPress for the posts you are publishing to Discourse
make sure that the “Enable Discourse Comments” option is enabled:
If you have not previously had comments enabled on your WordPress site, you may not want to enable them now for posts that are not yet connected to Discourse. To avoid having the WordPress comment form displayed for those posts, you can enable comments site-wide, then select the “Remove WordPress Comments Template” setting from the WP Discourse Commenting Options page:
Can you check to make sure that comments are enabled for a post that you have linked to Discourse? Sometimes the “Discussion” option isn’t shown on the edit page. You might need to select it from the “Screen Options” menu to see it:
Hmm, I’m not seeing anything on the page that indicates the comment template is being loaded. The reference to discourse-embed-js in your screenshot is not from the WP Discourse plugin. I think it’s related to the script that was loaded by the wp-discourse-embed plugin. It’s actually triggering an error on your site:
Failed to load resource: the server responded with a status of 404 () discourse-embed.js
There’s also a <div id="discourse-comments"></div> on the page that’s from the wp-discourse-embed plugin, not the WP Discourse plugin.
I wouldn’t enable the WP Discourse “Load Comments With Ajax” setting until you confirm that there’s an issue with cached comments on the site. Even if that was the case, it should be able to get the comment template to display.
Are there any plugins installed on your site related to comments? I’m wondering if a plugin, or the site’s theme is preventing the WordPress comment template from being loaded. The WP Discourse plugin depends on that template being loaded. There are a few workaround for that, but they’re all fairly technical.
I’m sure it will be possible to get things sorted out
I’m going from memory here, but I don’t think the edited comments.php file is the cause of the issue. What should be happening is that instead of your theme’s comments.php file being loaded, the WP Discourse plugin should be loading its own comments section when this function is called from your theme: comments_template().
Have a look at your theme’s single.php file, or whatever file is used for displaying a post that you have linked to Discourse. See if the file contains a call to comments_template(). It will look something like this:
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
It’s the call to coments_template() that should trigger the WP Discourse comments to load.
I could be wrong about this. I can have a closer look if that doesn’t help to sort things out.