Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-15T14:32:21.363Z
Answers.Text: Ok, looks like I needed a better understanding of Relations. I put in the ID of the category and it worked.
Answers.UserDisplayName: Johann Dyck
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-15T09:42:12.737Z
Answers.LastActivityDate: 2018-06-15T09:42:12.737Z
Answers.UserDisplayName: Robin Schambach
Body: <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>
  
Tags: <templating><entries><categories><relatedto><multi-site>
Title: Can I get entries related to one category from a specific site?
ThreadText: # 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.  
  
  ---
  
  