<p><a href="https://craftcms.stackexchange.com/a/15673/57">Luke's</a> answer is correct.  Your issue is that you have two tag groups defined (<code>default</code> and <code>blogTags</code>) and you happen to have a <code>weddings</code> tag defined for both groups.</p>

<p>The Tag field you have in your <code>blog</code> section has it source limited to the <code>blogTags</code> tag group, so you need to be explicit about which tags you want to pull from because of the duplicate tags.</p>

<pre><code>{% set tag = craft.tags.group('blogTags').slug('weddings').first() %}
{% set entries = craft.entries.relatedTo(tag) %}
</code></pre>

CC BY-SA 3.0
2016-07-01T15:49:19.857Z
thanks Brad and Luke - so darn obvious in the end. Much appreciated support
joomkit
CC BY-SA 3.0
2016-07-01T00:08:51.300Z
2016-07-01T00:08:51.300Z
2017-04-13T12:51:00.200Z
Brad Bell
<p>You were very close! You are looping through <code>craft.entries.section('blog')</code> which doesn't use your tag query. You simply need to loop through the results of your query which you've set in the <code>entries</code> variable. </p>

<p>You may want to grab your weddings tag using the tag's id or slug as <code>.search</code> will find any tag with the string 'weddings' in it. </p>

<p>It might also be a good idea to use the conditional to check <code>entries</code> is returning something first, before outputting it.</p>

<pre><code>{% set tag = craft.tags.slug('weddings').first() %}
{% set entries = craft.entries.relatedTo(tag) %}

{% if entries|length %}
  {% for entry in entries.limit(5) %}
    {# get stuff #}
  {% endfor %}
{% endif %}
</code></pre>

CC BY-SA 3.0
2016-06-27T16:11:26.610Z
Thanks Luke - thats not working for me - i get zero results.....
joomkit
CC BY-SA 3.0
2016-06-27T16:16:08.027Z
Try using `.title` instead of `.slug` and change 'weddings` to the tags Title.
Luke Pearce
CC BY-SA 3.0
2016-06-28T08:14:52.370Z
Mmm something is not right here. The title is 'weddings' lowercase.  I noticed that some tags were 'wedding flowers' and read something about spaces causing issues in tags..so deleted tags.and re added...but still getting nothing
joomkit
CC BY-SA 3.0
2016-06-28T08:29:34.200Z
`.title` and `.slug` will only return absolute matches. If you want to return any tags that include 'weddings' then you'll need to use `.search` just you were to begin with.
Luke Pearce
CC BY-SA 3.0
2016-06-28T10:44:51.687Z
Still i get nothing output....Mmm gonna call Brandon direct!
joomkit
CC BY-SA 3.0
2016-06-28T11:06:58.283Z
What have you tried to debug so far? Have you tried seeing if `tag` is an element? Does `entries|length` return more than 0?
Luke Pearce
CC BY-SA 3.0
2016-06-28T19:30:41.113Z
HAHAHA - "**going to call Brandon direct!**" That should be on a T-Shirt :)
Matt P
CC BY-SA 3.0
2016-07-01T06:21:36.743Z
Once you've applied `entries|length`, you made Craft query for the entries and `entries` is now either null or an array of entry models. Both do not have a `limit()` method and the code should throw an error at this line. At least with devMode enabled.
carlcs
CC BY-SA 3.0
2016-06-27T12:50:28.717Z
2016-06-27T12:56:24.430Z
2016-06-27T12:56:24.430Z
Luke Pearce
<p>I want to get a list of entries in a template that have one specific tag 'weddings' and exclude entries that do not have this tag.</p>

<pre><code>{% set tag = craft.tags.search('weddings').first() %}

{% if tag %}          
  {% set entries = craft.entries.relatedTo(tag) %}
  {% for entry in craft.entries.section('blog').limit(5) %}
    {# get stuff #}
  {% endfor %}
{% endif %}
</code></pre>

<p>But this gets me all blog entries - even those without the Tag weddings. What am I missing?</p>

<templating><tags>
List entries for a single tag from blog section
# List entries for a single tag from blog section

(Asked by: username_0 on 2016-06-27)

I want to get a list of entries in a template that have one specific tag 'weddings' and exclude entries that do not have this tag.
{% set tag = craft.tags.search('weddings').first() %}

{% if tag %}          
  {% set entries = craft.entries.relatedTo(tag) %}
  {% for entry in craft.entries.section('blog').limit(5) %}
    {# get stuff #}
  {% endfor %}
{% endif %}

But this gets me all blog entries - even those without the Tag weddings. What am I missing?

**Tags:** templating, tags


---

## 2 answers

### Answer by username_1 on 2016-07-01. Score: 2 | Accepted answer

Luke's answer is correct.  Your issue is that you have two tag groups defined (default and blogTags) and you happen to have a weddings tag defined for both groups.
The Tag field you have in your blog section has it source limited to the blogTags tag group, so you need to be explicit about which tags you want to pull from because of the duplicate tags.
{% set tag = craft.tags.group('blogTags').slug('weddings').first() %}
{% set entries = craft.entries.relatedTo(tag) %}

> **Comments:**
> **username_0**: thanks Brad and Luke - so darn obvious in the end. Much appreciated support  

---

### Answer by username_2 on 2016-06-27. Score: 4

You were very close! You are looping through craft.entries.section('blog') which doesn't use your tag query. You simply need to loop through the results of your query which you've set in the entries variable. 
You may want to grab your weddings tag using the tag's id or slug as .search will find any tag with the string 'weddings' in it. 
It might also be a good idea to use the conditional to check entries is returning something first, before outputting it.
{% set tag = craft.tags.slug('weddings').first() %}
{% set entries = craft.entries.relatedTo(tag) %}

{% if entries|length %}
  {% for entry in entries.limit(5) %}
    {# get stuff #}
  {% endfor %}
{% endif %}

> **Comments:**
> **username_0**: Thanks Luke - thats not working for me - i get zero results.....  
> **username_2**: Try using `.title` instead of `.slug` and change 'weddings` to the tags Title.  
> **username_0**: Mmm something is not right here. The title is 'weddings' lowercase.  I noticed that some tags were 'wedding flowers' and read something about spaces causing issues in tags..so deleted tags.and re added...but still getting nothing  
> **username_2**: `.title` and `.slug` will only return absolute matches. If you want to return any tags that include 'weddings' then you'll need to use `.search` just you were to begin with.  
> **username_0**: Still i get nothing output....Mmm gonna call Brandon direct!  
> **username_2**: What have you tried to debug so far? Have you tried seeing if `tag` is an element? Does `entries|length` return more than 0?  
> **username_3**: HAHAHA - "**going to call Brandon direct!**" That should be on a T-Shirt :)  
> **username_4**: Once you've applied `entries|length`, you made Craft query for the entries and `entries` is now either null or an array of entry models. Both do not have a `limit()` method and the code should throw an error at this line. At least with devMode enabled.  

---

