<p>It means you've got a loop on an element query somewhere in your templates.  For example:</p>

<pre><code>{% for entry in craft.entries.section('mySection') %}
    {{ entry.title }}
{% endfor %}
</code></pre>

<p>You should update it to use <code>.all()</code> like so:</p>

<pre><code>{% for entry in craft.entries.section('mySection').all() %}
    {{ entry.title }}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2019-07-15T21:45:08.350Z
2019-07-15T21:45:08.350Z
Brad Bell
<p>Why is this depreciated? Is there an example of the preferred method? </p>

<blockquote>
  <p>Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.</p>
</blockquote>

<p>Thanks. </p>

<templating>
Explanation of Deprecation Warnings
# Explanation of Deprecation Warnings

(Asked by: username_0 on 2019-07-15)

Why is this depreciated? Is there an example of the preferred method?

> Looping through element queries directly has been deprecated. Use the all() function to fetch the query results before looping over them.

Thanks.

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2019-07-15. Score: 1

It means you've got a loop on an element query somewhere in your templates.  For example:
{% for entry in craft.entries.section('mySection') %}
    {{ entry.title }}
{% endfor %}

You should update it to use .all() like so:
{% for entry in craft.entries.section('mySection').all() %}
    {{ entry.title }}
{% endfor %}


---

