# Add discourse category link to wordpress

**URL:** https://meta.discourse.org/t/add-discourse-category-link-to-wordpress/180220
**Category:** WordPress
**Created:** [February 18, 2021, 4:18pm UTC](https://meta.discourse.org/t/add-discourse-category-link-to-wordpress/180220 "2021-02-18T16:18:29Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![cosdesign](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cosdesign/32/208585_2.png) [@cosdesign](https://meta.discourse.org/u/cosdesign)
#### Post date: [February 18, 2021, 10:18pm UTC](https://meta.discourse.org/t/add-discourse-category-link-to-wordpress/180220/2 "2021-02-18T22:18:46Z")

</div>

Hello,

Unfortunately from what I can see, there’s no option for that. But you can do it by following these steps:

1. Install the [discourse shortcode plugin](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910) and use the schortcode in your text sidebar widget `[discourse_topics]`

2. Browse to `wp-discourse-shortcodes-master / lib / discourse-topic-formatter.php` search for this line  
`$category = $this->find_discourse_category( $topic );`

3. After that line, paste this:  
`$category_url = $this->discourse_url . "/c/{$category['slug']}/{$category['id']}";`

4. Search for this ( you’ll find two lines, for top and bottom positions ):  
`$output .= '<span class="wpds-shortcode-category">' . $this->discourse_category_badge( $category ) . '</span>';`

5. Replace them with:  
`$output .= '<span class="wpds-shortcode-category"><a class="wps-cat-link" target="_blank" href="' . esc_url( $category_url ) . '">' . $this->discourse_category_badge( $category ) . '</a></span>';`

6. Go to your wp dashboard and check this box and click Save options  

Keep in mind that this will be overwritten when you’ll update the wp-discourse-shortcodes plugin, so you might wanna make a backup before updating. Good luck.

---

_[View the full topic](https://meta.discourse.org/t/add-discourse-category-link-to-wordpress/180220)._
