wp_avatar()

Twig function of the framework; its result is HTML and is printed without escaping.

{{ wp_avatar(id, size = 96) }}

The avatar of a user as an img element, as returned by get_avatar(). The output is HTML and is printed unescaped. Returns '' if the ID is null, the user does not exist or avatars are turned off.

{{ wp_avatar(attrs.author, 48) }}
ParameterTypeDefaultDescription
idint|nullrequiredID of the user.
sizeint96Width and height of the avatar in pixels.

Returns string