<p>You should replace <code>craft.fields.getFieldbyHandle()</code> with <code>craft.app.fields.getFieldByHandle()</code> (note the additional <code>.app</code> in there).</p>

CC BY-SA 4.0
2020-07-15T17:28:49.980Z
2020-07-15T17:28:49.980Z
Oli
<p>I'm querying a dropdown field to loop through all of the options and followed best practice (so I thought) in the twig template. Does anyone know how to update for the deprecation below?</p>
<p>Deprecation message:</p>
<blockquote>
<p>craft.fields.getFieldByHandle() has been deprecated. Use craft.app.fields.getFieldByHandle() instead.</p>
</blockquote>
<p>Code line:
<code>{% set siteOptions = craft.fields.getFieldbyHandle('siteSelector').settings.options %}</code></p>

<deprecation>
craft.fields.getFieldByHandle() has been deprecated
# craft.fields.getFieldByHandle() has been deprecated

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

I'm querying a dropdown field to loop through all of the options and followed best practice (so I thought) in the twig template. Does anyone know how to update for the deprecation below?

Deprecation message:

> craft.fields.getFieldByHandle() has been deprecated. Use craft.app.fields.getFieldByHandle() instead.

Code line:
`{% set siteOptions = craft.fields.getFieldbyHandle('siteSelector').settings.options %}`

**Tags:** deprecation


---

## 1 answers

### Answer by username_1 on 2020-07-15. Score: 2 | Accepted answer

You should replace `craft.fields.getFieldbyHandle()` with `craft.app.fields.getFieldByHandle()` (note the additional `.app` in there).


---

