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() %}

1 Answer 1


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

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

  • Ok, looks like I needed a better understanding of Relations. I put in the ID of the category and it worked. Jun 15, 2018 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.