# WP Discourse: Modify existing comments template

**URL:** https://meta.discourse.org/t/wp-discourse-modify-existing-comments-template/256661
**Category:** WordPress
**Tags:** wordpress
**Created:** [March 1, 2023, 12:37pm UTC](https://meta.discourse.org/t/wp-discourse-modify-existing-comments-template/256661 "2023-03-01T12:37:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![OrkoGrayskull](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orkograyskull/32/275883_2.png) [@OrkoGrayskull](https://meta.discourse.org/u/OrkoGrayskull)
#### Post date: [March 1, 2023, 12:37pm UTC](https://meta.discourse.org/t/wp-discourse-modify-existing-comments-template/256661/1 "2023-03-01T12:37:44Z")

</div>

Hi there,

I use a custom comment template on my WordPress installation. Therefore I do not want to enable the “Commenting” feature provided in [WP Discourse](https://github.com/discourse/wp-discourse).

What I would like to achieve now is an extension to my existing template:

- How can I query if a post has already been published in Discourse?
- If the check returns “true” (published), I would like to simply include a link to the post in the Discourse forum

How can I achieve this?

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [March 2, 2023, 8:17am UTC](https://meta.discourse.org/t/wp-discourse-modify-existing-comments-template/256661/2 "2023-03-02T08:17:21Z")

</div>

Hey @OrkoGrayskull 🙂

If a post is published to Discourse using the [WP Discourse](https://github.com/discourse/wp-discourse) plugin the permalink to the post is saved in the wp post meta field `discourse_permalink`. So you just need to show that in your theme where you want the link to appear. Something like this:

```html
<li><a href="<?php get_post_meta(get_the_ID(), 'discourse_permalink', true); ?>">Discuss this on our form</a></li>

```

---

<div class="post-metadata">

### Author: ![OrkoGrayskull](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/orkograyskull/32/275883_2.png) [@OrkoGrayskull](https://meta.discourse.org/u/OrkoGrayskull)
#### Post date: [March 2, 2023, 8:29am UTC](https://meta.discourse.org/t/wp-discourse-modify-existing-comments-template/256661/3 "2023-03-02T08:29:25Z")

</div>

Thanks @angus.

I got it working! 🙂

```plaintext

if ( get_post_meta( get_the_ID(), 'discourse_permalink', true ) ) {
   $discourse_permalink = get_post_meta( $post->ID, 'discourse_permalink', true );       
   echo '<a href="' . esc_url( $discourse_permalink ) . '" title="Forum">Comment on our forum</a>';
}

```
