# WP Discourse Embed Plugin

**URL:** https://meta.discourse.org/t/wp-discourse-embed-plugin/30814
**Category:** WordPress
**Tags:** wordpress
**Created:** [July 6, 2015, 3:42am UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814 "2015-07-06T03:42:08Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [July 6, 2015, 3:42am UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814/1 "2015-07-06T03:42:08Z")

</div>

I just published a new WordPress plugin to embed Discourse comments using Discourse [Embed code](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963).

[https://github.com/techAPJ/wp-discourse-embed](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:

 ![](https://global.discourse-cdn.com/meta/original/3X/7/1/71d4ed793ed3839116df637ec5da740b3a3cb5dd.png) 

**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:

```plaintext
<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](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963).

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](https://github.com/techAPJ/wp-discourse-embed)

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [July 6, 2015, 11:06am UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814/2 "2015-07-06T11:06:21Z")

</div>

How is this plugin different from [wp-discourse](https://github.com/discourse/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](http://www.redditblog.com/2015/03/announcing-embeddable-comment-threads.html), 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.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [July 7, 2015, 11:11am UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814/3 "2015-07-07T11:11:09Z")

</div>

> [@erlend\_sh](#):
>
> How is this plugin different from wp-discourse?

The [wp-discourse-embed](https://github.com/techAPJ/wp-discourse-embed) plugin uses the [Discourse Embed code](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963). Here are the pros and cons as compared to [wp-discourse](http://github.com/discourse/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:

> [@Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963):
>
> Discourse has the ability to embed the comments from a topic in a remote site using a Javascript API that creates an IFRAME. For an example of this in action, check out [Coding Horror’s blog](http://blog.codinghorror.com/welcome-to-the-internet-of-compromised-things/#discourse-comments). The blog is run via [Ghost](https://ghost.org/) but the comments are embedded from his [Discourse forum](http://discourse.codinghorror.com/t/welcome-to-the-internet-of-compromised-things/3550). One important thing to note with this setup is that users have to navigate to your forum to post replies. This is intentional, as we feel that the posting interface on a Discourse forum is currently much richer than what we …

* * *

> [@erlend\_sh](#):
>
> I embed my Discourse topic into my blogpost, effectively using Discourse for comments without hosting it myself.

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

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 3, 2016, 6:50pm UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814/4 "2016-09-03T18:50:11Z")

</div>

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

> [@Fix published date and author for topics created via wp-discourse-embed plugin](https://meta.discourse.org/t/fix-published-date-and-author-for-topics-created-via-wp-discourse-embed-plugin/49681):
>
> I recently installed [wp-discourse-embed](https://github.com/techAPJ/wp-discourse-embed) plugin on [Quarter to Three](http://www.quartertothree.com/fp) WordPress blog. As soon as I installed the plugin there was an influx of new topics being created for existing (old) WP posts. I ran this rake task to fix the published date and author for topics that are linked to old WP posts: desc "Fetch WP data" task "users:fetch\_wp\_data" =\> [:environment] do puts "Fetching WP data" i = 0 TopicEmbed.find\_each do |topic\_embed| begin html = open(topic\_embed.embed\_url).read …

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [October 23, 2020, 7:15pm UTC](https://meta.discourse.org/t/wp-discourse-embed-plugin/30814/17 "2020-10-23T19:15:23Z")

</div>

I’m just adding a note here about an issue that was reported last month with comments not being displayed due to recent changes in how many browsers are now setting the referrer policy for cross site requests. That issue has been fixed in the core Discourse code. As long as your Discourse site is running the latest code, you should be able to use the [WP Discourse](https://github.com/discourse/wp-discourse) Embed plugin without any issues.

For more details about the issue, see [https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963#setting-the-referrer-policy](https://meta.discourse.org/t/embedding-discourse-comments-via-javascript/31963#setting-the-referrer-policy).
