Title: wp_image_src_get_dimensions
Published: March 9, 2021
Last modified: February 24, 2026

---

# apply_filters( ‘wp_image_src_get_dimensions’, array|false $dimensions, string $image_src, array $image_meta, int $attachment_id )

## In this article

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

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

Filters the ‘wp_image_src_get_dimensions’ value.

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

 `$dimensions`array|false

Array with first element being the width and second element being the height, or
false if dimensions could not be determined.

`$image_src`string

The image source file.

`$image_meta`array

The image meta data as returned by ‘[wp_get_attachment_metadata()](https://developer.wordpress.org/reference/functions/wp_get_attachment_metadata/)‘.

`$attachment_id`int

The image attachment ID. Default 0.

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

    ```php
    return apply_filters( 'wp_image_src_get_dimensions', $dimensions, $image_src, $image_meta, $attachment_id );
    ```

[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#L1757)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/media.php#L1757-L1757)

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

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

Determines an image’s width and height dimensions based on the source file.

  |

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

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

## User Contributed Notes

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