Exclude category from channel entries (with pagination) I'm trying to paginate a channel of entries but I also need to exclude any entries that relate to a specific category.

This is what I have so far...

{% set insightCategory = craft.categories({"slug": "insights"}).first() %}
{% set insightsEntryIds = craft.entries.section('blogChannel').relatedTo({targetElement: insightCategory}).limit(null).ids() %}

{% paginate craft.entries.section('blogChannel')|without(insightsEntryIds) as entries %}
    {% for blogEntry in entries %}
        &lt;p&gt;{{ blogEntry.title }} ({{ blogEntry.id }})&lt;/p&gt;
    {% endfor %}
{% endpaginate %}


Unfortunately the pagination doesn't seem to work with the |without filter. How can I achieve this?

Thanks
The without filter converts your ElementCriteriaModel into an array of entry models (the same as find() does). But that array won't work with paginate, as explained in the docs:


  This parameter needs to be an actual ElementCriteriaModel object; not an array of elements. So don’t call find() on the object.


So you need to query for the entries you're after directly with an ElementCriteriaModel. The workaround to get there would be to pass an array of entry IDs into the id() parameter.

{% set categoriesToExclude = craft.categories({slug: 'berlin'}) %}
{% set entriesToExcludeIds = craft.entries.section('news').relatedTo(categoriesToExclude).limit(null).ids() %}
{% set entryIds = craft.entries.section('news').limit(null).ids()|without(entriesToExcludeIds) %}

{% set entries = craft.entries.id(entryIds) %}

{% paginate entries as entriesOnPage %}
    ...
{% endpaginate %}


It's not recommended to use the without filter with objects anyways (→ see Brad's answer to a related question)!