# Adding the wp-id parameter to topics created through WordPress

**URL:** <https://meta.discourse.org/t/adding-the-wp-id-parameter-to-topics-created-through-wordpress/64630>\
**Category:** Development\
**Tags:** wordpress\
**Created:** [16 Giugno 2017, 6:30pm UTC](https://meta.discourse.org/t/adding-the-wp-id-parameter-to-topics-created-through-wordpress/64630 "2017-06-16T18:30:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)\
**Post date:** [20 Giugno 2017, 3:52pm UTC](https://meta.discourse.org/t/adding-the-wp-id-parameter-to-topics-created-through-wordpress/64630/5 "2017-06-20T15:52:01Z")

</div>

> [@simon](#):
>
> On WordPress, finding a post by the value of a meta-key can be done, but it’s not efficient.

Is `WP_Query` not efficient? (I’m not a WP expert, so just curious)

> <https://wordpress.stackexchange.com/questions/144078/get-posts-by-meta-value/144079#144079>

[This post](https://kinsta.com/blog/wp-query/) might help speed things up

I’m leaning toward not adding an `external_post_id` because I feel like keeping track of the topic\_id which the api returns should be the responsibility of the integrator not Discourse. In order to make looking up a topic by `external_post_id` efficient in Discourse we would also have to index the column in the db table and create/modify an api endpoint to allow for searching by that param.

> [@simon](#):
>
> So on the WordPress end there’s no advantage of using the topic\_id metadata over using a new wp\_id that’s added as a property to Discourse topics.

If there is no advantage to using one or the other right now, I’m going to push you do use the topic\_id in the metadata. I guess I’m having a hard time seeing the downside if you are already tracking the topic\_id that you couldn’t just hit the [/t/{id}.json endpoint](http://docs.discourse.org/#tag/Topics%2Fpaths%2F~1t~1%7Bid%7D.json%2Fget) and get the title and the posts\_count?

---

_[View the full topic](https://meta.discourse.org/t/adding-the-wp-id-parameter-to-topics-created-through-wordpress/64630)._
