WPDev.one
Core Function
View Source on Trac ↗

wp_get_attachment_image_src()

wp_get_attachment_image_src( mixed $attachment_id, mixed $size = 'thumbnail', mixed $icon = false )

Retrieves an image to represent an 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 fall back to a mime type icon. Default false.

Return Value

((array)
(array | false) { Array of image data, or boolean false if no image is available.

Function Information

Since Version
2.5.0
Source File
wp-includes/media.php
Advertisement