<p>How many categories do you have in that locations group? A criteria model returns the first 100 elements only by default, so any category falling behind that wouldn't be listed, no matter if there's related entries or not.</p>

<p>Add <code>limit(null)</code> to your <code>craft.categories</code> criteria model to make it return all categories.</p>

CC BY-SA 3.0
2016-05-07T09:24:24.623Z
2016-05-07T09:24:24.623Z
carlcs
<p>Here's my code:</p>

<pre><code>{% for category in craft.categories.group('artistLocation') %}

    {% set entryCount = craft.entries.relatedTo(category).total() %}

    {% if entryCount %}
        &lt;li&gt;
            &lt;a href="{{ category.url }}"&gt;{{ category.title }} ({{ entryCount }})&lt;/a&gt;
        &lt;/li&gt;
    {% endif %}

{% endfor %}
</code></pre>

<p>For some reason, this is only returning the first six categories with entries associated.</p>

<p><a href="https://www.dropbox.com/s/a2ut7j48acnq1g0/Screenshot%202016-05-06%2010.49.34.png?dl=0" rel="nofollow">https://www.dropbox.com/s/a2ut7j48acnq1g0/Screenshot%202016-05-06%2010.49.34.png?dl=0</a></p>

<p>Nothing in the error logs that are shedding any light on it for me.</p>

<p>Any ideas would be awesome!</p>

CC BY-SA 3.0
2016-05-06T17:03:36.763Z
Hard to tell without looking at your database, but are you sure you actually have more than 6 `artistLocation` categories assigned to various entries?
Brad Bell
<categories>
Category list not returning all related entries
# Category list not returning all related entries

(Asked by: username_0 on 2016-05-06)

Here's my code:
{% for category in craft.categories.group('artistLocation') %}

    {% set entryCount = craft.entries.relatedTo(category).total() %}

    {% if entryCount %}
        
            {{ category.title }} ({{ entryCount }})
        
    {% endif %}

{% endfor %}

For some reason, this is only returning the first six categories with entries associated.
https://www.dropbox.com/s/a2ut7j48acnq1g0/Screenshot%202016-05-06%2010.49.34.png?dl=0
Nothing in the error logs that are shedding any light on it for me.
Any ideas would be awesome!

**Tags:** categories

> **Comments:**
> **username_1**: Hard to tell without looking at your database, but are you sure you actually have more than 6 `artistLocation` categories assigned to various entries?  

---

## 1 answers

### Answer by username_2 on 2016-05-07. Score: 2 | Accepted answer

How many categories do you have in that locations group? A criteria model returns the first 100 elements only by default, so any category falling behind that wouldn't be listed, no matter if there's related entries or not.

Add `limit(null)` to your `craft.categories` criteria model to make it return all categories.


---

