1

I'm trying to return entries based on some criteria. I exclude entries with a given value like this:

{% set someEntries = craft.entries({
    level: 1,
    id: '1,2,3,4,5',
    myOtherField: 'not blue'
}) %}

But it doesn't work if I try to exclude by multiple values:

{% set someEntries = craft.entries({
    level: 1,
    id: '1,2,3,4,5',
    myOtherField: 'not blue and not green'
}) %}

It's not in the docs and I've tried a few different syntax but had no luck.

1

This should do what you're looking for:

{% set someEntries = craft.entries({
    level: 1,
    id: '1,2,3,4,5',
    myOtherField: 'and, not blue, not green'
}) %}

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.