Core Function
View Source on Trac ↗ wp_get_attachment_image_url()
wp_get_attachment_image_url( mixed $attachment_id, mixed $size = 'thumbnail', mixed $icon = false ) Gets the URL of an image attachment.
Parameters 2 required
| Name / Type | Description |
|---|---|
| $attachment_id int | Image attachment ID. Required |
| mixed | (string | int[]) $size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'thumbnail'. Required |
| $icon bool | Optional. Whether the image should be treated as an icon. Default false. |
Return Value
((string)
(string | false) Attachment URL or false if no image is available. If `$size` does not match
any registered image size, the original image URL will be returned.
Function Information
Since Version
4.4.0
Source File
wp-includes/media.php
Advertisement