Find entries that have a category selected from a category field within a matrix block I've got a Section that uses a Matrix field, that has a block, that has a categories field in it.

I want to find all entries using this Matrix field, who has a categories field and has a certain category selected.

I'm looking at the Relations documentation and trying the following code, but perhaps i'm barking up the wrong tree here?

{% set cat = craft.categories.slug('print') %}
{% set entries = craft.entries.section('projectsEntries').relatedTo({
sourceElement: cat,
field: 'contentBuilder.relatedCategories.content'
}) %}

{% for entry in entries %}

{{ entry.title }}

{% endfor %}
Try using targetElement: cat instead of sourceElement – in my experience the entries are considered the source of the relation in cases like these, not the categories.

Edit: Also, the field parameter of the relatedTo method shouldn't include the Matrix field's block type, only the actual category field – i.e. contentBuilder.content, not contentBuilder.relatedCategories.content.