<p>Relations don't work with a slug. You'll need to insert an <code>ElementQuery</code> an <code>Element</code> or the ID of an <code>Element</code></p>

<pre><code>{% set entries = craft.entries
    .section('sectionHandle')
    .relatedTo(category)
    .site('siteHandle')
    .all() 
%}
</code></pre>

<p>However this will only work in certain cases where all category ids are the same for both sites. You'll need to to fetch the category from the other site at first if these are different </p>

CC BY-SA 4.0
2018-06-15T14:32:21.363Z
Ok, looks like I needed a better understanding of Relations. I put in the ID of the category and it worked.
Johann Dyck
CC BY-SA 4.0
2018-06-15T09:42:12.737Z
2018-06-15T09:42:12.737Z
Robin Schambach
<p>If I can get entries in a category like this:</p>

<p><code>{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').all() %}</code></p>

<p>And a entries from another site like this:</p>

<p><code>{% set entries = craft.entries.section('sectionSlug').site('siteSlug').all() %}</code></p>

<p>Is there a way to combine them and get entries from another site in a certain category. The following isn't working for me:</p>

<p><code>{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').site('siteSlug').all() %}</code></p>

<templating><entries><categories><relatedto><multi-site>
Can I get entries related to one category from a specific site?
# Can I get entries related to one category from a specific site?

(Asked by: username_0 on 2018-06-15)

If I can get entries in a category like this:

`{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').all() %}`

And a entries from another site like this:

`{% set entries = craft.entries.section('sectionSlug').site('siteSlug').all() %}`

Is there a way to combine them and get entries from another site in a certain category. The following isn't working for me:

`{% set entries = craft.entries.section('sectionSlug').relatedTo('categorySlug').site('siteSlug').all() %}`

**Tags:** templating, entries, categories, relatedto, multi-site


---

## 1 answers

### Answer by username_1 on 2018-06-15. Score: 1 | Accepted answer

Relations don't work with a slug. You'll need to insert an ElementQuery an Element or the ID of an Element
{% set entries = craft.entries
    .section('sectionHandle')
    .relatedTo(category)
    .site('siteHandle')
    .all() 
%}

However this will only work in certain cases where all category ids are the same for both sites. You'll need to to fetch the category from the other site at first if these are different

> **Comments:**
> **username_0**: Ok, looks like I needed a better understanding of Relations. I put in the ID of the category and it worked.  

---

