<p>I believe you'll need to look at using the following syntax:</p>

<pre><code>craft.entries.relatedTo('and', { targetElement: tags })
</code></pre>

<p>You might have some luck using the <a href="https://github.com/aelvan/Similar-Craft" rel="nofollow noreferrer">Similar</a> plugin.</p>

CC BY-SA 3.0
2017-02-17T12:02:24.140Z
2017-02-17T12:02:24.140Z
crawf
<p>I would like to retrieve related entries that have the same tags, not just one similar tag, but all of them.</p>

<p>At the moment I do something like:</p>

<pre><code>{% set tags = entry.tagActualite %}
{% set relatedEntries = craft.entries.relatedTo(tags).id('not ' ~ entry.id).limit(5).find() %}

{% if relatedEntries | length %}
    {% for entry in relatedEntries %}
        do stuff
    {% endfor %}
{% endif %}
</code></pre>

<p>But it retrieves any entry with at least one similar tag.</p>

<p>How would i check against ALL tags ? </p>

<relations><tags>
Find related entries with the same tags
# Find related entries with the same tags

(Asked by: username_0 on 2017-02-16)

I would like to retrieve related entries that have the same tags, not just one similar tag, but all of them.
At the moment I do something like:
{% set tags = entry.tagActualite %}
{% set relatedEntries = craft.entries.relatedTo(tags).id('not ' ~ entry.id).limit(5).find() %}

{% if relatedEntries | length %}
    {% for entry in relatedEntries %}
        do stuff
    {% endfor %}
{% endif %}

But it retrieves any entry with at least one similar tag.
How would i check against ALL tags ?

**Tags:** relations, tags

---

## 1 answers

### Answer by username_1 on 2017-02-17. Score: 2

I believe you'll need to look at using the following syntax:
craft.entries.relatedTo('and', { targetElement: tags })

You might have some luck using the Similar plugin.


---

