Link existing forum topic to new WordPress post

“Publish to Discourse” should only be available as an option if the “Use existing topic” field is empty.

The bbPress plugin I spoke of deals with it in a similar fashion:


Ah okay, I only used BBPress briefly but I think that makes sense.

I mentioned the idea to some of the people in my site’s community and they loved the idea. I know that blogging options are used in some of the big names in Forum software and a lot of sites use them to broaden their SEO-- IGN and Buzzfeed are big ones that come to mind.

You could have it automatically post to a category like “Community Written” or something. It would be a great way to scout potential prospects for writing staff.

People love recognition and if you publish someone’s thoughts onto your main page, that has to be encouraging to a) post more often and b) post with substance.


Just to clarify on one more point, what I’m suggesting here is strictly the ability to link (and unlink for that matter) WordPress posts and Discourse threads as you see fit.

I am not asking for the contents of a linked Discourse post to be pulled into the WP thread or anything like that. That work is up to the Editor. Personally I’d just write a brief manual excerpt (maybe in 140 characters or less and let WordPress deal with the Twitter/Facebook publishing as well) and link to the forum topic, with the comments showing below.


To be honest, just the ability to make a forum post publish on the blog, would be a great first step.

I needed this, this week in fact. Toyed with trying to move existing posts into the new WP-created topic but it didn’t do what I needed.

Would be a great addition for the reasons mentioned previously.

There was a plugin developed a while back but does not look like it has been worked on in awhile. Not sure if this can be incorpated into the wp-discourse plugin.

1 Like

I don’t know if something like that should be in the wp-discourse plugin, but I think that using Discourse to create content for a WordPress site makes a lot of sense.


I would also like to have this kind of plugin/feature. Our forums are much more active than blog section, and news break first there. In vBulletin 4 was great feature to promote topic to cms/front page as article. Something like that will be awesome to have for Discourse first posts to be published as blog posts in WP.

I have a situation right now where I want to embed a topic in a couple different sites. Which means that I now have a WordPress site where I want to use an existing topic as the embedded comments. Which brings me to this:

This PR adds a field to the meta box (Existing Topic ID). When a value is added to this field it uses that topic for the comments as opposed to the topic that was published. It doesn’t matter if Published is checked or not. This will override it. Clear out the field and it resumes it’s previous setup.

I’d love to see this make it into the core plugin! Let me know if I can do anything to help make it so.


I know @simon’s working on something similar but did this make it to the core?

If yes, how do I access this?

Not yet. It will be there right away.


Not to bug you but I’ve been looking at various options to see how I can get discourse working and WP working on existing topics. Was even contemplating the

It’s a blocker for me from deploying to production.
Kind sir, can I ask for an ETA? :slight_smile:

1 Like

Thanks for this great plugin @simon. I’d love to use this plugin for my blog but have put manual link to posts in the past. Is there any way I can manually make a connection and tell the plugin that a post already has a topic on discourse?

Not yet, but thanks for the reminder! I’ve been meaning to implement this for a while now. Would a discourse_topic shortcode work for you? It would take the topic URL as a parameter.


I am not entirely sure how the WP Discourse plugin injects the comments into the page. Would the shortcode then do this wherever I put it?

I was more thinking of having a way to specify an existing url inside a post, rather than pushing to discourse with a new topic, like so:


Essentially, just a way to link an older post to an existing comment thread.

I’ve done some work on making a shortcode for displaying Discourse topics. At this point, it only displays the first post in the topic, it doesn’t display any of the comments. It gives you the option of displaying the full post content, an excerpt, or just the title and some metadata about the topic.

The styles I’m using here are rough, but this gives you an idea of how it could work. Adding a couple of shortcodes like this:

[discourse_topic topic_id=384 excerpt_length=45]

[discourse_topic topic_id=385 excerpt_length=45]

will output this:

The shortcodes can be added anywhere you like within a post.

This isn’t yet available in the version of the plugin that’s in the WordPress repository. If the basic idea seems correct I can add it to the repo in the next few days.


I’m not sure how this would help in my scenario.

My problem is that I have manually created Discourse topics for old blog posts and then simply put a link to the forum at the end of the post:


Obviously this is sub-optimal because it doesn’t show any of the comments on the blog and gives no indication of engagement.

What I hoped to do is install the WP Discourse plugin and use it for any new blog posts but also go back to old posts and manually link the posts with the forum topics with the hope that they would display the same way as any new post would (ie. showing the comments directly on the blog post). Does this make sense?

Yes it does. I’ve moved this discussion to an existing topic. There seem to be two separate feature requests in this topic: linking posts in a way that will pull the Discourse comments to WordPress, and just adding a Discourse topic link to a WordPress post.

It is possible to link an existing post to an existing topic so that the Discourse comments are displayed on WordPress. This is based on what @joebuhlig does in the PR in this topic, but with some changes to the Discourse meta box. When the WordPress post editor for a post that is not linked to Discourse is opened, it will first look like this:


Selecting Create new Topic displays this:


Selecting Link to Existing Topic displays this:


After either creating a topic, or linking to an existing topic, the metabox displays this:


Selecting the Unlink Post checkbox removes the Discourse metadata from the post so that it no longer displays Discourse comments.

The biggest issue with doing this is that it’s not possible to set the Discourse topic embed_url for topics that already exist on Discourse. That could be made to work, but would require some changes to the Discourse code.


This is exactly what I was after. I don’t understand what the Discourse topic embed_url would do and whether I would need it but I’m looking forward to trying this out, once the PR is merged. Thanks!


Thanks Simon! Yes that is along the lines of what I am trying to do.

Being able to display any post within the topic (instead of just the first) would also be super cool and helpful.

Thank you for the helpful reply.

So just to be clear, I cannot use this shortcode yet? I tried adding [discourse_topic topic_id=1259 excerpt_length=45] to one of my wordpress posts but nothing was displayed.

I am assuming that what I am pointing to below is the topic ID?