# Bulk tagging topics based on keywords

**URL:** <https://meta.discourse.org/t/bulk-tagging-topics-based-on-keywords/120526>\
**Category:** Product Support\
**Created:** [June 16, 2019, 4:20pm UTC](https://meta.discourse.org/t/bulk-tagging-topics-based-on-keywords/120526 "2019-06-16T16:20:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [June 16, 2019, 9:40pm UTC](https://meta.discourse.org/t/bulk-tagging-topics-based-on-keywords/120526/2 "2019-06-16T21:40:54Z")

</div>

I’m on my phone. Here are some parts

```
   posts = Post.where("raw like '%badword%')
 posts.each do |post|
 Tag.create(some stuff here) # this won't work
 end

```

If there are lots of words, you’d stick them in an arrays and loop through them. You’ll need to find an example of what fields are required to create a tag. Probably topic\_id and name.

---

_[View the full topic](https://meta.discourse.org/t/bulk-tagging-topics-based-on-keywords/120526)._
