Discourse comments are not reflected on WordPress blog (2025 version)

Continuing the discussion from Discourse comments are not reflected on Wordpress blog:

Hi. I’ve installed a fresh copy of Discourse 3.4.0 (4abee26a32) and WordPress 6.7.2 on my local PC for testing and I’m unable to get the comments to sync from Discourse to WordPress (though the initial post does sync from WordPress to Discourse). My issue seems to be very similar to the much older report linked above. Could this be a regression?

I’ve enabled all the logging, but this is all I see in the logs of my WordPress instance:

[2025-02-26 21:24:55] connection.INFO: check_connection_status.successful_connection  
[2025-02-26 21:24:55] connection.INFO: check_connection_status.valid_scopes  
[2025-02-26 21:28:49] publish.INFO: create_post.post_success {"wp_title":"This is a test","wp_author_id":"1","wp_post_id":7} 
[2025-02-26 21:28:49] publish.INFO: create_post.body_valid {"wp_title":"This is a test","wp_author_id":"1","wp_post_id":7} 
[2025-02-26 21:28:49] publish.INFO: create_post.after_publish {"post_id":7,"remote_post_type":"create_post","discourse_post_id":"34","discourse_topic_id":"16","discourse_permalink":"https://discourse.cs.siue.edu/t/this-is-a-test/16"} 
[2025-02-26 21:28:49] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"7"} 
[2025-02-26 21:29:27] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"7"} 
[2025-02-26 21:53:39] webhook_topic.INFO: update_topic_content.update_post_metadata_success {"post_ids":"7"} 

And this is all I see in the comments section of my WordPress post:

The count of responses increments immediately, but I do not see the actual comments. I’m also not seeing any errors in the system logs at /var/log/php-fpm/www-error.log.

Does anyone have any ideas about what might be causing this problem or how to go about debugging it? Thanks.

Hey @Gregory_Bartholomew, I can guarantee you that it’s not a regression. Let’s step through what about your local setup might be causing this.

  1. What theme are you using?
  2. Is it a block enabled theme?
  3. Have you customised the theme?
  4. What settings have you enabled for the WP Discourse plugin (perhaps share the meta file from the logs).

At some point keeping Wordpress commenting enabled did exactly that. It was at least a year ago, and I never checked if that behaviour has changed or if it was a theme dependent question.

If you’re experiencing a similar issue, we can investigate that in parallel. Are you able to share the answers to the same questions?

I could, but that wasn’t any issue after I disabled Wordpress commenting. OP’s issue is that Wordpress commenting overdrives Discourse. And there can be an easy solution too — that post is never linked to Discourse :smirk:

I see. I think your issue may have been different from @Gregory_Bartholomew’s. Let’s see if we can get some specificity on his setup and get to the bottom of his issue. Each issue has to be treated anew.

Well, I don’t have any ongoing issues, because in any situation I don’t allow native commenting of Wordpress. Discourse takes care of that totally nice. My thoughs were just a weak solution idea, and leads to configuration problems :man_shrugging:

Are you saying I need to disable WordPress’ built-in comment system somehow?


It’s currently the default twentytwentyfive them.

Yes it is. Also (but probably unrelated), there was a small bug in the default them that required me to load and re-save the index.html file. The problem and workaround is documented here.

Other than the above workaround to fix an apparently unrelated glitch, no, I haven’t made any customizations to the theme.

Sure, here is the meta output from the logs page.

### This file is included in log downloads ###

### Server ###

WordPress - 6.7.2
PHP - 8.3.17
MySQL - 10.11.10

### Active Plugins ###

Fedora SSR Endpoint - 1.3.0
WP-Discourse - 2.5.6

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

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

One slight inaccuracy I notice in the meta output is that I’m not using “MySQL” but rather its fork “MariaDB” (mariadb-server-10.11.10-1.fc41.x86_64). Also, I have the php-mysqlnd package installed (php-mysqlnd-8.3.17-1.fc41.x86_64).

Thanks for that detail @Gregory_Bartholomew. As it’s a block-enabled theme, have you tried the WP Discourse Comments Block?

Yes, I saw that video and I have already enabled the checkbox at the top:

image

So, just to confirm, you’ve gone to Appearance > Editor, opened the Single Post Template and added the WP Discourse block into the template?

No, I don’t remember doing anything like that. I guess I missed it in the video. I’ll try that now. Thanks!

1 Like

Well, it seemed promising, but when I clicked “view site” to go back to the main index page, it crashed. :confused:

From the php-fpm log:

[27-Feb-2025 15:21:37 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function WPDiscourse\Shared\mb_convert_encoding() in /wordpress/wp-content/plugins/wp-discourse/lib/template-functions.php:335
Stack trace:
#0 /wordpress/wp-content/plugins/wp-discourse/lib/discourse-comment-formatter.php(136): WPDiscourse\DiscourseCommentFormatter\DiscourseCommentFormatter->fix_avatars_in_quotes()
#1 /wordpress/wp-content/plugins/wp-discourse/lib/discourse-comment.php(312): WPDiscourse\DiscourseCommentFormatter\DiscourseCommentFormatter->format()
#2 /wordpress/wp-content/plugins/wp-discourse/blocks/comments/comments.php(34): WPDiscourse\DiscourseComment\DiscourseComment->comments_template()
#3 /wordpress/wp-includes/class-wp-block.php(537): render_block_wpdc_comments()
#4 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render()
#5 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render()
#6 /wordpress/wp-includes/blocks/post-template.php(123): WP_Block->render()
#7 /wordpress/wp-includes/class-wp-block.php(537): render_block_core_post_template()
#8 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render()
#9 /wordpress/wp-includes/class-wp-block.php(517): WP_Block->render()
#10 /wordpress/wp-includes/blocks.php(2191): WP_Block->render()
#11 /wordpress/wp-includes/blocks.php(2243): render_block()
#12 /wordpress/wp-includes/block-template.php(263): do_blocks()
#13 /wordpress/wp-includes/template-canvas.php(12): get_the_block_template_html()
#14 /wordpress/wp-includes/template-loader.php(106): include('...')
#15 /wordpress/wp-blog-header.php(19): require_once('...')
#16 /wordpress/index.php(17): require('...')
#17 {main}
  thrown in /wordpress/wp-content/plugins/wp-discourse/lib/template-functions.php on line 335

Edit1: It says undefined function mb_convert_encoding(). Maybe I just need to install a missing PHP package?

Edit2: Yep, that’s all it was. I needed to install php-mbstring. Everything seems to be working now. Thanks!

One small issue I’m still seeing is that the emojis and avatars don’t appear to be showing:

I guess I still need to configure something?

On the Discourse side, my avatar is just the default letter-in-a-circle:

Also, the emoji doesn’t seem to be showing correctly on the Discourse side either, but I’m less concerned with that because I don’t admin the production Discourse instance that I hope to eventually use. :slightly_smiling_face:

Edit: Nevermind about the avatars problem. It looks like it might be at least partly due to the way my environment is setup. I’m pointing WordPress at port 3000, but the avatars are resolving to http://localhost:4200/letter_avatar_proxy/v4/letter/.... I’ll probably just disable those anyway.

I’m glad you got it working!

1 Like