wp_get_attachment_image_src WordPress Filter Hook

The wp_get_attachment_image_src hook is used to retrieve the image src for an attachment. It is generally used with the wp_get_attachment_image function.

apply_filters( 'wp_get_attachment_image_src', array|false $image, int $attachment_id, string|int[] $size, bool $icon ) #

Filters the attachment image source result.


Parameters

$image

(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.
  • '3'
    (bool) Whether the image is a resized image.

$attachment_id

(int)Image attachment ID.

$size

(string|int[])Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).

$icon

(bool)Whether the image should be treated as an icon.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More