# Tag posts that are published from WordPress to Discourse

**URL:** https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927
**Category:** Administrators
**Tags:** wordpress, how-to
**Created:** [October 19, 2018, 1:32am UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927 "2018-10-19T01:32:11Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [October 19, 2018, 1:32am UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/1 "2018-10-19T01:32:12Z")

</div>

Posts can now be tagged when they are published with the [WP Discourse](https://github.com/discourse/wp-discourse) plugin. To tag a post, click on the Discourse meta box Advanced Options link to expand the meta box. Add tags to the Tag input, either one at a time, or as a comma separated list.

 ![33%20PM](https://global.discourse-cdn.com/meta/original/3X/4/e/4e5b99aad50c2c6971b1c4f6ea64cee2bfab45ae.png)

Any spaces in tag names will be converted to hyphens. The maximum number of tags is set by the ‘Maximum Number of Tags’ option found on the Publishing Settings tab. The maximum number of tags will default to 5 if the setting is left empty. Tags that are not allowed on Discourse due to Site Setting or category restrictions will be omitted when the post is published to Discourse.

---

<div class="post-metadata">

### Author: ![Kayla](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kayla/32/128523_2.png) [@Kayla](https://meta.discourse.org/u/Kayla)
#### Post date: [July 15, 2020, 8:39pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/2 "2020-07-15T20:39:39Z")

</div>

Is there a way to hook into this to prepopulate specific custom post types with specific tags?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2020, 4:13pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/3 "2020-07-20T16:13:54Z")

</div>

The [WP DIscourse](https://github.com/discourse/wp-discourse) plugin doesn’t have a hook that can be used to automatically add tags to a post before it gets published to Discourse. I’ll add a hook for that can be used for this and let you know when that has been done.

---

<div class="post-metadata">

### Author: ![Fma965](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fma965/32/259795_2.png) [@Fma965](https://meta.discourse.org/u/Fma965)
#### Post date: [May 14, 2022, 1:31pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/4 "2022-05-14T13:31:14Z")

</div>

Sorry to bump such a old post but did this get added? i’ve tried looking through the source code but couldn’t find anything.

---

<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: [May 16, 2022, 5:21pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/5 "2022-05-16T17:21:42Z")

</div>

We haven’t yet added that hook. I’ll add it into the next release 👍

---

<div class="post-metadata">

### Author: ![Fma965](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fma965/32/259795_2.png) [@Fma965](https://meta.discourse.org/u/Fma965)
#### Post date: [May 16, 2022, 5:23pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/6 "2022-05-16T17:23:45Z")

</div>

It’s been 2 years 😮 it should have been added ages ago 😆

Nah just kidding, thanks in advance 🙂 👍

---

<div class="post-metadata">

### Author: ![Fma965](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fma965/32/259795_2.png) [@Fma965](https://meta.discourse.org/u/Fma965)
#### Post date: [July 4, 2022, 9:54pm UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/7 "2022-07-04T21:54:52Z")

</div>

Hey, i see a new release has been created, was this added?

---

<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: [July 5, 2022, 7:11am UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/8 "2022-07-05T07:11:29Z")

</div>

No, that release concerned another, specific, issue. I’ll make sure it’s in the next one.

---

<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: [July 6, 2022, 11:11am UTC](https://meta.discourse.org/t/tag-posts-that-are-published-from-wordpress-to-discourse/99927/9 "2022-07-06T11:11:18Z")

</div>

You can use the `wpc_publish_body` filter to achieve this, e.g.

```php
add_filter( 'wpdc_publish_body', function( $body, $remote_post_type, $post_id ) {
   if ( 'create_post' === $remote_post_type ) {
      $body['tags'] = array( 'tag1', 'tag2' );
   }
   return $body;
}, 10, 3);

```

`2.4.5` adds `post_id` as a param to the filter to make the specific case of adding tags to posts of certain types easier.
