Discourse comment box appearing 2 times

2 discourse comment box is appearing.

Platform: WordPress
Theme: Astra

Before we were using extol theme then moved to astra. Added comment section hook by astra site builder and placed under the post by display condition.

All blog posts showing the comment section normally except 3 posts (Showing discourse comment section twice).

Can anyone please help me?

Hey there, this looks like an issue with your theme, or perhaps how you’re using “Astra Site Builder”, but let’s see if we can help you nevertheless.

Perhaps you could elaborate on what this looks like? Did you use any code? Could you link to the documentation for the “Astra Site Builder”. Is it a block-enabled theme? Try to give as many details as possible.

1 Like

Thanks @angus for your prompt response.

Actually I don’t see any code while editing the code and I am using theme default single post template which shouldn’t have the discourse comment code.

Strange thing is this happening with only following posts: Strange thing is this happening with only following posts: https://www.mamap - Pastebin.com [Please check pastebin, I added links there]

Other posts are showing the only comment box that I added by astra site builder.

Yes astra is block-enabled theme. Here is it’s doc: Documentation Docs

Did you use the WP Discourse Comments Block?

1 Like

Yes I used WP Discourse comment block on Astra Site builder. Even I disable astra site builder hook still this extra discourse comment box visible under the post.

Previously we used extol theme. We added Discourse comment block in single post page itself.

Then we moved to Astra.

Astra has some limitation, so we can’t edit the default single post template. That’s why I added discourse comment box via astra site builder hook, which is working perfectly.

Even if I disable astra site builder hook still these 3 pages showing Discourse comment box, we didn’t added comment box block in the post. And really couldn’t figure it out from where its coming here.

Please disable the “Enable Discourse Comments” setting in WP Discourse > Comments and tell me what effect that has (make sure you save the setting change).

If I disable this settings both comment box disappear.

1 Like

Ok, you can re-enable it.

The issue is that whatever combination of theme and site builder you’re using, you’ve got both a PHP post template and a block post template on the same page (that’s not normal). That’s the reason this is happening.

If you want to load both templates in a single page you need to remove the comments_template line from the post PHP template.

1 Like

If its from php, I am wondering why its only visible to specific 3 posts.
I couldn’t find comments_template in single.php file. :cry:

1 Like

If I disable comments from customizer settings, only comment box disappear. Still discourse comment box visible.

1 Like

Still couldn’t figure it out.

When someone comments on discourse forum thread a new comment section appear under the related blog post. I couldn’t find comments_template .

Would you please suggest any article, video tutorial regarding this?

@angus

1 Like

I hide 1 comment section by additional css.

Its a temporary solution. If there are any effective way please let me know I will apply.

1 Like

There is a comments template function call in the PHP templates you’re using that is causing this. It will look something like this.

<?php comments_template(); ?> 

Where it is will depend on what PHP templates you’re using. Find that function and you’ll solve the problem. There isn’t much more help we, or an article, can give unfortunately.

The only other thing I’d suggest is reaching out to the folks who support “Astra”. The underlying issue here is this combination of PHP templates and blocks you have going on. Perhaps they can shed some light on that.

2 Likes

First, I want to say a big, heartfelt thank you to @angus for sticking with me through this and providing such thoughtful guidance. Your support means a lot, and I genuinely appreciate the time and effort you’ve put into helping me troubleshoot this. Let me walk you through everything I’ve explored and tried, hoping it might help others facing similar issues.

Background and Initial Setup:
Initially, we were using the Extol theme, where we added the Discourse comment block directly in the single post page itself. This worked perfectly fine. When we switched to the Astra theme, things became more complicated. Since Astra has some limitations (like not being able to easily edit the default single post template), I added the Discourse comment box via Astra Site Builder hooks and placed it under the post based on a display condition.

This worked smoothly for most posts, but for three specific posts, the Discourse comment section appeared twice. I couldn’t figure out why this was happening only for these posts, while others displayed correctly. This anomaly led me to think there might be a remnant of the old Extol setup, but I couldn’t pinpoint anything definitive.

Exploring the Issue:

  • I first checked the post editor, looking for any settings or blocks that might have been manually enabled or disabled for Discourse comments. Surprisingly, there was nothing there—no extra blocks, no different settings.
  • Next, I disabled the Astra Site Builder hook to see if that would remove the extra comment section. It didn’t; the duplicate box remained. This suggested the duplication was happening outside the Astra Site Builder setup.
  • I then tried disabling “Enable Discourse Comments” in the WP Discourse settings. As you advised, this removed both comment sections, which indicated that both were being generated through this integration somehow.
  • After re-enabling it, I dug deeper into the theme files. I searched through single.php, content-single.php, and other related template files for any instance of comments_template();. Unfortunately, I couldn’t find anything explicitly calling this function. This left me puzzled. If it was a PHP template issue, why couldn’t I find it?
  • I also tried checking for custom templates. Maybe these three posts were using a different template? I couldn’t confirm this either. Everything pointed to the default setup.
  • Another theory was related to comment synchronization—maybe when someone commented on the Discourse forum, it triggered another comment section to appear under the related blog post. This seemed plausible, but I couldn’t find a setting or documentation that directly linked to this behavior.
  • I resorted to a temporary CSS fix to hide the duplicate comment section:

Added CSS on WP Theme Customizer Additional CSS

#comments {
    display: none !important;
}

Added CSS on Astra hook:

#comments {
    display: block !important;
}

While this worked, I agree it’s not a permanent solution. I’d much prefer to address the root cause.

Thoughts and Theories:

  • I suspect it could be a deeper issue with how Astra handles hooks and blocks—perhaps some conflict or duplication in the way the Discourse comments are embedded.
  • Another possibility is that there’s a hidden setting or leftover configuration from the old Extol theme that’s still influencing things.
  • Or it might be related to how Discourse synchronizes with WordPress. When a comment is made in the forum, it might be triggering something within the WordPress site, creating that extra section.

What I Haven’t Tried:

  • Contacting Astra Support: As you suggested, this might be worth pursuing. They might be aware of similar issues or can provide insights into how their theme handles comments and hooks.
  • Disabling all plugins except WP Discourse: This might help isolate if another plugin is causing this behavior.
  • Testing with a completely fresh post: Creating a new post from scratch and seeing if the issue replicates might reveal something.

Next Steps:
For now, I think I’ll explore contacting Astra support and possibly running more tests with plugins disabled. I might also try a different approach by using a child theme and seeing if I can manually handle the Discourse comments section more precisely.

Again, Angus, thank you so much for your help and patience. Your insights have been invaluable, and even though I haven’t cracked it yet, I feel closer to understanding what’s happening. If anyone else has thoughts, insights, or experiences with similar issues, I’d love to hear them!

I’ll keep digging and will update here if I discover anything new. Cheers!

2 Likes

Do you have Show Existing WP Comments setting enabled by any chance?

2 Likes

I tried by enabling / disabling the settings, didn’t make any effect on extra discourse comment box.

Thanks @Arkshine

1 Like

My bad, I was not looking at the right issue!
I thought you were talking about just this one:


I think your issue is expected.
Astra theme doesn’t support the Full Site Editing feature or work with blocks.
In other words, Astra is not a block theme, and to customize pages, you need to use a third-party page builder (such as Elementor, in your case).

You will surely see a duplicate if you are not using the Discourse block to replace the original Comment block. Angus shows what you would need to do if you had a block theme in his video: WP Discourse Comments Block.

You are not replacing the comment area when you add the Discourse block using hooks; you place custom code at a specific location.


What is the solution?

If you prefer the look/location of the Astra hook, there is a way to remove the native WP comment area. You can add this PHP code. See How to Add Custom PHP Code in the Astra Theme? if you need help with how.

add_action(
	'init',
	function() {
		if ( class_exists( 'Astra_Loop' ) ) {
			remove_action( 'astra_template_parts_content', array( Astra_Loop::get_instance(), 'template_parts_comments' ), 15 );
		}
	},
	11
);

Hope that helps!

4 Likes

Thank you so much, @Arkshine! :tada:
Finally, the native comment section is no more visible—what a journey it has been!

And a huge thank you to @angus as well. Your patience, guidance, and deep insights were truly invaluable throughout this process. I sincerely appreciate the time and effort you put into helping me navigate this issue.

From testing different settings to debugging the mix of block and PHP templates, I explored everything—from disabling Astra hooks to tweaking CSS, checking the comments template, and even tracking down why only certain posts were affected. It was a rollercoaster of trial and error, but every step helped me understand the system better.

This wouldn’t have been possible without your expertise and willingness to assist. Your help didn’t just fix the issue—it taught me so much about WordPress, Discourse, and theme integrations. I’m beyond grateful.

To anyone facing similar issues: Keep testing, keep learning, and never hesitate to ask for help. The community is amazing! :rocket:

3 Likes