I have a site with channels ‘articles’ and ‘tutorials.’ An article entry has a matrix field which contains an entry field to link to a tutorial. Every tutorial is linked from within at least one article.

I would like each tutorial page to link back to the articles it appears in.

If I'm on a tutorial page and have the following code in my template…

{% set articles = craft.entries.section('articles').relatedTo(entry) %}
{{ articles|length }}

articles|length is always zero.

I did a test with just a simple entry field to link to a tutorial and that works fine. Is there something special that needs to be done to get it to work with a matrix field? Could it be a configuration issue?

1 Answer 1


Have a look at the 'Going Through Matrix' section at http://buildwithcraft.com/docs/relations#the-relatedTo-param.

{% set articles = craft.entries.section('articles').relatedTo({
    targetElement: entry,
    field: 'myMatrixField.fieldHandle'
}) %}
  • This works. Thanks. I thought I had tried this and it didn't work, but I must have slipped the block type handle in there along with the field handle. Nov 30, 2015 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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