wp_get_attachment_image_url

SummerySummery

Get the URL of an image attachment.

Syntax

wp_get_attachment_image_url( int $attachment_id, string|array $size = 'thumbnail', bool $icon = false )

ParametersParameters

$attachment_id

(int) (Required) Image attachment ID.

$size

(string|array) (Optional) Image size to retrieve. Accepts any valid image size, or an array of width and height values in pixels (in that order).

Default value: 'thumbnail'

$icon

(bool) (Optional) Whether the image should be treated as an icon.

Default value: false

ReturnReturn

(string|false) Attachment URL or false if no image is available.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Introduced.
Scroll to Top