WP Discourse Embed Plugin

AI-generated summary

The WP Discourse Embed Plugin allows users to embed Discourse comments into their WordPress blog posts using the Discourse Embed code. The plugin takes two options: Discourse URL and Embed Discourse comments on posts published after date. It also adds author nickname in meta tags and allows for displaying comment count under each topic on the blog front page.

techAPJ created this plugin, which differs from wp-discourse as it requires minimal configuration and no API key. However, it has less features and limited customization options.

techAPJ clarified that this plugin is not suitable for embedding Discourse topics into blog posts without hosting it, as the blog hostname must be present in Admin > Customize > Embedding.

simon noted that a recent issue with comments not being displayed due to changes in browser referrer policies has been fixed in the core Discourse code, and users should be able to use the WP Discourse Embed plugin without issues as long as their Discourse site is running the latest code.

I just published a new WordPress plugin to embed Discourse comments using Discourse Embed code.

https://github.com/techAPJ/wp-discourse-embed

This WordPress plugin injects the Discourse embed code in blog posts, allowing you to use Discourse as community engine.

It takes two options:

Discourse URL should be the URL of your Discourse instance, this field is required.

Embed Discourse comments on posts published after date is an optional field, if provided only blog posts published after the date you specified will use Discourse comments (hiding the original WordPress comments). Blog posts published before the provided date will use original WordPress comments.

That’s it once you have activated the plugin and provided Discourse URL, you should start seeing Discourse comments embedded under your blog posts!

If you want to show comment count under each topic on blog front page, then add this HTML snippet (in your theme index file) under topic markup:

<a href="<?php permalink_link(); ?>#discourse-comments">Discussion</a>

The above snippet will show as:

Discussion (8 replies)

Where 8 is the reply posts count for that particular topic.

This plugin also adds author nickname in meta tag, like:

<meta name="author" content="techapj">

Where techapj is WP nickname of post author.

This plugin assumes that you have already configured embedding settings as instructed here.

Download the plugin, and start contributing! – GitHub - arpitjalan/wp-discourse-embed: WordPress plugin that lets you use Discourse as the community engine for a WordPress blog · GitHub

How is this plugin different from wp-discourse? They literally have the same introductory description, which is very confusing.

This WordPress plugin allows you to use Discourse as a community engine for your WordPress blog.

I guess it has something to do with how wp-discourse requires API access, whereas wp-discourse-embed is “lower commitment” with no API key needed, working more like the “paste-and-you’re-done” type of embedding you get from the likes of Disqus. Sound about right?

Would definitely appreciate more clarification though. What are the different use cases? What’s the overlap (do they have the same strategy for styling comments?).

If this could work like Reddit embeds, that’d be super cool. As in:

  1. I write a blog post
  2. I announce the blog post on a DIscourse forum like Meta
  3. I embed my Discourse topic into my blogpost, effectively using Discourse for comments without hosting it myself.

The wp-discourse-embed plugin uses the Discourse Embed code. Here are the pros and cons as compared to wp-discourse plugin:

Pros:

  • Requires minimal configuration
  • Comments HTML is auto created, so styling is not required.
  • Can enable Discourse comments only on posts published after specified date.

Cons:

  • Not much customizable, hence less features.
  • Comments HTML can not be styled as per the theme.

wp-discourse-embed is basically a WordPress plugin for:


This is not possible because the blog hostname should be present in Admin > Customize > Embedding.

To fix published date and author for topics linked to old WP posts see:

Estou apenas adicionando uma nota aqui sobre um problema relatado no mês passado, onde os comentários não eram exibidos devido a mudanças recentes na forma como muitos navegadores estão configurando a política de referenciador para solicitações entre sites. Esse problema foi corrigido no código principal do Discourse. Desde que seu site Discourse esteja executando o código mais recente, você deverá conseguir usar o plugin WP Discourse Embed sem problemas.

Para mais detalhes sobre o problema, veja https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963#setting-the-referrer-policy.