A WordPress-centric search engine for devs and theme authors

wp_calculate_image_srcset ›

apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id )
Parameters: (5)
  • (array) $sources { One or more arrays of source data to include in the 'srcset'. @type array $width { @type string $url The URL of an image source. @type string $descriptor The descriptor type used in the image candidate string, either 'w' or 'x'. @type int $value The source width if paired with a 'w' descriptor, or a pixel density value if paired with an 'x' descriptor. } }
    Required: Yes
  • (array) $size_array Array of width and height values in pixels (in that order).
    Required: Yes
  • (string) $image_src The 'src' of the image.
    Required: Yes
  • (array) $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
    Required: Yes
  • (int) $attachment_id Image attachment ID or 0.
    Required: Yes
Defined at:

Filters an image's 'srcset' sources.


$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );