2

I’m aware of the relatedTo() parameter for entries that belong to a category but how can I show entries that are NOT relatedTo() a certain category?

4

I found this to work, although maybe there’s a better method.

{% set excludedCategory = craft.categories.id('100') %}
{% set excludedEntries = craft.entries.section('blog').status('live').relatedTo(excludedCategory).ids() %}

{% set entryIds = craft.entries.section('blog').status('live').ids() | without(excludedEntries) %}
{% set entries = craft.entries.section('blog').status('live').id(entryIds) %}

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.