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 %}

1 Answer 1


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

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.