# Using a tag in multiple tag groups with parent

**URL:** https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991
**Category:** Bug
**Created:** [October 14, 2019, 11:23pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991 "2019-10-14T23:23:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [October 14, 2019, 11:23pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/1 "2019-10-14T23:23:21Z")

</div>

I have a situation where I need to use the same tag in multiple tag groups that use parent tags, it is possible to add the tag to multiple groups, but then when I select the parent tag, the child tag that is in that group does not show up in the list. This is a bit hard to explain so here’s an example:

Parent-tag-1  
unique-child-tag-1  
common-tag  
Parent-tag-2  
unique-child-tag-2  
common-tag

So when I have common-tag in both parent tag groups, the common-tag does not show in the tag selector after I select either parent tags, if I remove the common tag from one of the groups, it will show in the other.

Is this intended behavior? I can’t see a reason why you shouldn’t be able to use the common tag with each parent tag, but maybe it is too complex to make it work this way.

---

<div class="post-metadata">

### Author: ![HAWK](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hawk/32/86627_2.png) [@HAWK](https://meta.discourse.org/u/HAWK)
#### Post date: [October 15, 2019, 10:09pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/2 "2019-10-15T22:09:20Z")

</div>

@neil is probably best to answer this. He’s done the most work with tags and groups.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [October 16, 2019, 2:56pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/3 "2019-10-16T14:56:23Z")

</div>

That’s a bug. It should be returning the common-tag for both parent tags. I’ll work on a fix.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [October 16, 2019, 6:49pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/5 "2019-10-16T18:49:43Z")

</div>

Fixed. Thanks for reporting it.

[https://github.com/discourse/discourse/commit/5ef49692e08fdb57e89042810cda9497c1f3be04](https://github.com/discourse/discourse/commit/5ef49692e08fdb57e89042810cda9497c1f3be04)

---

<div class="post-metadata">

### Author: ![davidkingham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidkingham/32/119528_2.png) [@davidkingham](https://meta.discourse.org/u/davidkingham)
#### Post date: [October 16, 2019, 7:59pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/6 "2019-10-16T19:59:26Z")

</div>

Thanks Neil, this fixed it for most scenarios, but I still have the issue. It took some experimenting but I finally figured out why. The parent tags are in a tag group, if I have `Limit one tag per topic from this group` turned on, then the common tag will not show up.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [November 5, 2019, 5:40pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/7 "2019-11-05T17:40:22Z")

</div>

> [@davidkingham](#):
>
> The parent tags are in a tag group, if I have `Limit one tag per topic from this group` turned on, then the common tag will not show up.

I tried to support this, but couldn’t come up with a solution. It might take a while to solve this (and any other future tag features) without looking at how to redo the `filter_allowed_tags` nightmare method. Implementing everything in one giant SQL statement is not working anymore.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [November 13, 2019, 6:57pm UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/9 "2019-11-13T18:57:38Z")

</div>

@davidkingham I was able to fix that bug after a bit of a rewrite of that code.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [November 25, 2019, 1:57am UTC](https://meta.discourse.org/t/using-a-tag-in-multiple-tag-groups-with-parent/130991/10 "2019-11-25T01:57:58Z")

</div>


