# Link existing forum topic to new WordPress post

**URL:** https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268
**Category:** Feature
**Tags:** wordpress
**Created:** [1월 21, 2015, 12:37오후 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268 "2015-01-21T12:37:25Z")
**Posts on this page:** 9
**Page:** 2

<div class="post-metadata">

### Author: ![pakl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pakl/32/103617_2.png) [@pakl](https://meta.discourse.org/u/pakl)
#### Post date: [1월 18, 2018, 7:02오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/21 "2018-01-18T07:02:56Z")

</div>

I am not entirely sure how the [WP Discourse](https://github.com/discourse/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:

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/d/cd5ede2fa2eedd99663b3a6808d535c4afbbe0ff.png)

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

---

<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: [1월 20, 2018, 2:49오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/22 "2018-01-20T02:49:27Z")

</div>

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:

```plaintext
[discourse_topic topic_id=384 excerpt_length=45]

[discourse_topic topic_id=385 excerpt_length=45]

```

will output this:

 ![41%20PM](https://global.discourse-cdn.com/meta/original/3X/e/a/ea172c182d9129ba4e49a0669688284d6c0bbede.png)

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.

---

<div class="post-metadata">

### Author: ![pakl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pakl/32/103617_2.png) [@pakl](https://meta.discourse.org/u/pakl)
#### Post date: [1월 20, 2018, 7:23오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/23 "2018-01-20T07:23:33Z")

</div>

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:

![image](https://global.discourse-cdn.com/meta/original/3X/d/0/d0eff797e2775af9a2360880771f37c0d5bda742.png)

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](https://github.com/discourse/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?

---

<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: [1월 21, 2018, 1:59오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/24 "2018-01-21T01:59:02Z")

</div>

> [@pakl](#):
>
> 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:

![12%20PM](https://global.discourse-cdn.com/meta/original/3X/8/9/894e836f02c00975527c8c69b2f67f2eb19486de.png)

Selecting Create new Topic displays this:

 ![28%20PM](https://global.discourse-cdn.com/meta/original/3X/a/d/ad16cbac6ae3988cf2e8c38e79170e871b76bedf.png)

Selecting Link to Existing Topic displays this:

 ![41%20PM](https://global.discourse-cdn.com/meta/original/3X/e/4/e4c9e4c2bca34c3718e08241b83a6257b4ae9d37.png)

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

 ![28%20PM](https://global.discourse-cdn.com/meta/original/3X/d/1/d124677353676087c2bb2cd3e89c7aa8bc620425.png)

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.

---

<div class="post-metadata">

### Author: ![pakl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pakl/32/103617_2.png) [@pakl](https://meta.discourse.org/u/pakl)
#### Post date: [1월 22, 2018, 7:28오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/25 "2018-01-22T07:28:09Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)
#### Post date: [4월 2, 2018, 6:54오후 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/26 "2018-04-02T18:54:27Z")

</div>

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?

 ![topic%20id](https://global.discourse-cdn.com/meta/original/3X/6/9/69b5508461dc68d002939dc641c9bc611b396735.jpg)

---

<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: [4월 2, 2018, 6:58오후 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/27 "2018-04-02T18:58:56Z")

</div>

> [@Ryan\_Collins1](#):
>
> So just to be clear, I cannot use this shortcode yet?

No, at the moment it only exists in my development version of the plugin.

---

<div class="post-metadata">

### Author: ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)
#### Post date: [4월 15, 2018, 4:08오후 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/28 "2018-04-15T16:08:59Z")

</div>

Ok, gotcha. Thank you.

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [12월 4, 2025, 11:33오전 UTC](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268/29 "2025-12-04T11:33:29Z")

</div>



[이전 페이지](https://meta.discourse.org/t/link-existing-forum-topic-to-new-wordpress-post/24268.md?page=1)
