# Hook for a topic's category id?

**URL:** https://meta.discourse.org/t/hook-for-a-topics-category-id/40002
**Category:** Development
**Created:** [2월 22, 2016, 7:44오후 UTC](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002 "2016-02-22T19:44:40Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [2월 24, 2016, 3:30오후 UTC](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002/3 "2016-02-24T15:30:56Z")

</div>

Here’s how I’m doing it in the [feature voting plugin](https://github.com/joebuhlig/discourse-feature-voting):

[https://github.com/joebuhlig/discourse-feature-voting/blob/master/assets/javascripts/initializers/feature-voting.js.es6#L10](https://github.com/joebuhlig/discourse-feature-voting/blob/master/assets/javascripts/initializers/feature-voting.js.es6#L10)

You get the topic first and then (if I remember correctly) you can do this:

`topic.category.id`

PS. I believe with the [plugin changes](https://meta.discourse.org/t/a-new-versioned-api-for-client-side-plugins/40051), I may have some updates to do to this file.

---

_[View the full topic](https://meta.discourse.org/t/hook-for-a-topics-category-id/40002)._
