Title: wp_get_attachment_image_src
Published: August 18, 2015
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#wp--skip-link--target)

Filters the attachment image source result.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#parameters)󠁿

 `$image`array|false

Array of image data, or boolean false if no image is available.

 * `0` 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.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#source)󠁿

    ```php
    return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/media.php#L1027)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L1027-L1027)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_get_attachment_image_src()](https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src/)`wp-includes/media.php` |

Retrieves an image to represent an attachment.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_get_attachment_image_src/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_get_attachment_image_src%2F)
before being able to contribute a note or feedback.