# Adding a tag in bulk without erasing existing tags

**URL:** https://meta.discourse.org/t/adding-a-tag-in-bulk-without-erasing-existing-tags/50709
**Category:** Support
**Created:** [September 27, 2016, 8:47am UTC](https://meta.discourse.org/t/adding-a-tag-in-bulk-without-erasing-existing-tags/50709 "2016-09-27T08:47:08Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [September 27, 2016, 3:14pm UTC](https://meta.discourse.org/t/adding-a-tag-in-bulk-without-erasing-existing-tags/50709/2 "2016-09-27T15:14:02Z")

</div>

Something like this:

> [@Batch tagging through console](https://meta.discourse.org/t/batch-tagging-through-console/47602/2):
>
> Something quick that I think will work. Might want to verify against a couple of records first before uncommenting the line to add the tag. tag = Tag.find\_by(name: 'soundcloud') category = Category.find\_by(name: 'music') Topic.where(category: category).each do |topic| if topic.first\_post.raw =~ /\<your keyword here\>/ puts topic.first\_post.raw # topic.tags \<\< tag end end

---

_[View the full topic](https://meta.discourse.org/t/adding-a-tag-in-bulk-without-erasing-existing-tags/50709)._
