In Craft 2, I used to be able to do this: https://craftcms.com/docs/2.x/templating/craft.fields.html#getfieldbyhandle-handle

{% set body = craft.fields.getFieldByHandle('body') %}
{{ body.instructions }}

In Craft 4 this no longer works - is there an updated syntax? I need to be able to get the field name when I only have its handle.

2 Answers 2


You'll need to use the Fields service (this changed in Craft 3):

{% set body = craft.app.fields.getFieldByHandle('body') %}

For more info see Common Services in the docs.

  • Thank you! I realised this at the exact same time you posted your answer of course! I'll accept your answer with thanks however.
    – Tchick
    Commented Nov 18, 2022 at 18:14

I see craft.fields.getFieldByHandle() is deprecated and replaced with craft.app.fields.getFieldByHandle()

See: https://craftcms.stackexchange.com/a/35811/4060

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.