wp_get_attachment_image_srcset

SummerySummery

Retrieves the value for an image attachment’s ‘srcset’ attribute.

Syntax

wp_get_attachment_image_srcset( int $attachment_id, array|string $size = 'medium', array $image_meta = null )

ParametersParameters

$attachment_id

(int) (Required) Image attachment ID.

$size

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

Default value: 'medium'

$image_meta

(array) (Optional) The image meta data as returned by 'wp_get_attachment_metadata()'.

Default value: null

ReturnReturn

(string|bool) A 'srcset' value string or false.

SourceSource

File: wp-includes/media.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Introduced.

See alsoSee also

Scroll to Top