<p>currently disabling multi site for tag is not supported</p>
<blockquote>
<p>unless you were to fork Craft and change the isLocalized() return
value from true to false</p>
</blockquote>
<p><a href="https://github.com/craftcms/cms/issues/3483#issuecomment-440782270" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/3483#issuecomment-440782270</a></p>
<p>so tag itself is always created for all languages but you need another thing.</p>
<p>you need adding tag to entry per site basis so you have to check tag field -&gt; advanced setting -&gt; Manage relations on a per-site basis -it seems you enabled this already-.</p>
<p>now if there is two site and tag1 is added or selected for site1 entry but tag1 is not selected for that entry on site2, if you change source Locale to site2 id on your code, tag1 is not showing on results. - still tag1 is available on site1 and site2 but is not showing up on result because you enabled manage tag on per site basis and tag1 is not attached to site2 entry -</p>

CC BY-SA 4.0
2021-03-30T14:08:09.137Z
2021-03-30T14:13:56.933Z
2021-03-30T14:13:56.933Z
user9975
<p>I have craft pro and have one tagGroup called Tags
Then I created a Tag field called newsTag like this:
<a href="https://i.sstatic.net/gCh5t.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gCh5t.png" alt="Tags field setup" /></a></p>
<p>When I add a tag for german, the tag is also created in the database for dutch and english, so when I get a list of used tags like this:</p>
<pre><code>{% set tagsEntries = craft.entries
    .section('news')
    .limit(null)
    .all() %}

{% for atag in craft.tags.relatedTo(tagsEntries) %}
    &lt;li {% if tag == atag.title %} class=&quot;is-active&quot; {% endif %}&gt;&lt;a href=&quot;{{ newsEntry.url }}/{{ atag.slug }}&quot;&gt;{{ atag.title }}&lt;/a&gt;&lt;/li&gt;
{% endfor %}
</code></pre>
<p>Now I get all tags used in all sites. when I use it like this:</p>
<pre><code>{% set tags = craft.tags.relatedTo({
      sourceElement: tagsEntries,
      sourceLocale: craft.site
    }) %}
</code></pre>
<p>Then I still get all tags, because when I look at the database the tag for German is also created for Dutch and English:</p>
<p>In the content table:</p>
<p><a href="https://i.sstatic.net/daJwr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/daJwr.png" alt="content table" /></a></p>
<p>When I remove the entry for site 1 and 3 (the dutch and english site) the it works, but will be added again on entry save...</p>
<p>Is it somehow possible to only save a tag for one site? That way I can get all the tags only used in that site and not all.</p>
<p>ps, this only happens with tags in entries that are used/enabled for 2 or more sites.</p>
<p>Thanks for the help,</p>
<p>Dimitri</p>

<localization><multi-site><tags>
How to add tags to an entry per site basis. And then only get the tags for that site in the frontend
# How to add tags to an entry per site basis. And then only get the tags for that site in the frontend

(Asked by: username_0 on 2021-03-24)

I have craft pro and have one tagGroup called Tags
Then I created a Tag field called newsTag like this:

When I add a tag for german, the tag is also created in the database for dutch and english, so when I get a list of used tags like this:
{% set tagsEntries = craft.entries
    .section('news')
    .limit(null)
    .all() %}

{% for atag in craft.tags.relatedTo(tagsEntries) %}
    {{ atag.title }}
{% endfor %}

Now I get all tags used in all sites. when I use it like this:
{% set tags = craft.tags.relatedTo({
      sourceElement: tagsEntries,
      sourceLocale: craft.site
    }) %}

Then I still get all tags, because when I look at the database the tag for German is also created for Dutch and English:
In the content table:

When I remove the entry for site 1 and 3 (the dutch and english site) the it works, but will be added again on entry save...
Is it somehow possible to only save a tag for one site? That way I can get all the tags only used in that site and not all.
ps, this only happens with tags in entries that are used/enabled for 2 or more sites.
Thanks for the help,
Dimitri

**Tags:** localization, multi-site, tags

---

## 1 answers

### Answer by username_1 on 2021-03-30. Score: 1

currently disabling multi site for tag is not supported

> unless you were to fork Craft and change the isLocalized() return
> value from true to false

<https://github.com/craftcms/cms/issues/3483#issuecomment-440782270>

so tag itself is always created for all languages but you need another thing.

you need adding tag to entry per site basis so you have to check tag field -> advanced setting -> Manage relations on a per-site basis -it seems you enabled this already-.

now if there is two site and tag1 is added or selected for site1 entry but tag1 is not selected for that entry on site2, if you change source Locale to site2 id on your code, tag1 is not showing on results. - still tag1 is available on site1 and site2 but is not showing up on result because you enabled manage tag on per site basis and tag1 is not attached to site2 entry -


---

