is it possible to grab all the entries in a section that arent related to a category?

So something like


Doesnt seem to work but is there some other syntax?


If you want to do it in a single query, Marion's answer is probably the best.

Otherwise, you could do something like this:

{% set idsHavingCategory = craft.entries.section('news').relatedTo(category).limit(null).ids() %}

{% set omitIds = 'and, not ' ~ idsHavingCategory|join(', not ') %}

{% set entries = craft.entries.section('news').id(omitIds) %}

Inspired by this article, which shows how to (1) grab ids, and (2) query against them:


Also references related solutions found in these answers:

| improve this answer | |

I got this to work with search:

{% set uncategorizedEntries
  = craft.entries.section('news').search('-category:*') %}

Here category is the category field. You are searching everything in news which does not have a category field that matches *.

| improve this answer | |
  • hmm yea i guess that would work but i cant imagine thats very performant. Hoping theres a more direct route to get this to work but maybe not yet. – Keith Mancuso Jul 3 '15 at 14:52

Another approach -- that might work for you -- is to filter on the output, rather than the query. For instance, using this query:

{% set entries = craft.entries.section('news') %}

Output using this loop:

{% for entry in entries if entry.category is empty %}
{% endfor %}


| improve this answer | |

Not sure if this will help much, but I did something similar with:

{% set allNews = craft.entries.section('news') %)


{% for entry in allNews.id("not #{category.id}") ... {% endfor %}

Hope that helps in some way.

| improve this answer | |
  • On second thought, I don't think this is going to be what you're looking for. I'll leave it though, in-case it helps in some other way. – Nicolaides Jul 2 '15 at 17:56
  • yea thats not really what i need i need to fet all the entries not in a category – Keith Mancuso Jul 3 '15 at 14:51

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.