This documentation describes unreleased changes on the main branch.

wp_attachment_image_url()

Twig function of the framework; its result is escaped like any value.

{{ wp_attachment_image_url(id, size = 'full') }}

The URL of an image from the media library in the given size, as returned by wp_get_attachment_image_url(). Returns '' if the ID is null, the attachment does not exist or has no image.

<meta property="og:image" content="{{ wp_attachment_image_url(attrs.imageId, 'large') }}">
ParameterTypeDefaultDescription
idint|nullrequiredID of the attachment.
sizestring'full'Registered image size, e.g. thumbnail, medium, large or full.

Returns string