This might be a stupid question... but I can't seem to figure it out.

I'd like to show the photo of an author beside their entry. I thought the proper variable was...


...until I logged out and my photo disappeared.

1 Answer 1


That will get you the url of the current user's photo. To get an author's photo do this:

{{ author.photoUrl }}

If the author is not defined in your context but the entry is, then get the entry's author's photo as follows:

{{ entry.author.photoUrl }}

In Craft 4, the following should be used:

{{ entry.author.photo.url ?? '' }}
  • This method is now deprecated. Does anyone know the current method? The documentation says "Use getPhoto().getUrl() instead." but when I try entry.author.getPhoto().getUrl() I get an error. Commented Nov 28, 2022 at 12:57
  • 1
    If either the author or photo is not set, it will result in an error. I've updated my answer with a Craft 4 version that falls back to an empty string.
    – Ben Croker
    Commented Nov 28, 2022 at 14:00
  • Thanks @Ben Croker. Hope life is good! Commented Nov 29, 2022 at 11:25

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.