wp_get_attachment_image_src

SummerySummery

Retrieves an image to represent an attachment.

Syntax

wp_get_attachment_image_src( int $attachment_id, string|int[] $size = 'thumbnail', bool $icon = false )

ParametersParameters

$attachment_id

(int) (Required) Image attachment ID.

$size

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

Default value: 'thumbnail'

$icon

(bool) (Optional) Whether the image should fall back to a mime type icon.

Default value: false

ReturnReturn

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

  • (string) Image source URL.
  • '1'
    (int) Image width in pixels.
  • '2'
    (int) Image height in pixels.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
2.5.0 Introduced.
Scroll to Top