I have something I can not get my head around.

This works as expected:


But when I am building an array to use as relation criteria like so:

{% set related = [{targetElement:22},{targetElement:33}] %}


Nothing returns.

It’s pretty late here in Berlin and I might be missing something simple but can not see what exactly. Anyone?

1 Answer 1


I don’t know what it is – I swear: every time – but the next thing I tried, immediately after posting the question was this:

{% set related = ['and',] %}
{% for relation in relations %}
    {% set related = related|merge([{targetElement:relation}]) %}
{% endfor %}

{% paginate craft.entries
    as entries %}   

That works.

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.