# שאלה מהירה לגבי קישור פרוגרמטי לנושא קיים

**URL:** <https://meta.discourse.org/t/quick-question-about-programmatic-link-to-existing-topic/186341>\
**Category:** WordPress\
**Created:** [10 באפריל,‏ 2021,‏ 7:05pm UTC](https://meta.discourse.org/t/quick-question-about-programmatic-link-to-existing-topic/186341 "2021-04-10T19:05:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [12 באפריל,‏ 2021,‏ 1:15am UTC](https://meta.discourse.org/t/quick-question-about-programmatic-link-to-existing-topic/186341/2 "2021-04-12T01:15:02Z")

</div>

Yes, you’re on the right track. In broad strokes, what you need to do is

1. Retrieve the topic details from discourse (unless you have these already)
2. Save the relevant details to the right post meta fields

It’s those post meta fields that you see in that function you linked that create the connection.

I’ve also added this to my [WP Discourse](https://github.com/discourse/wp-discourse) dev agenda: to make it easier to do this, i.e. using a single public utility function to achieve this goal. I’ve slotted this in for June.

Also take a look at the existing utility functions in `lib/plugin_utilities.php` and `lib/utilities.php`. And the concomitant `link_topic` method in `admin/discourse-sidebar/discourse-sidebar.php`.

Let me know how you go.

---

_[View the full topic](https://meta.discourse.org/t/quick-question-about-programmatic-link-to-existing-topic/186341)._
