Title: wp_image_maybe_exif_rotate
Published: November 12, 2019
Last modified: February 24, 2026

---

# apply_filters( ‘wp_image_maybe_exif_rotate’, int $orientation, string $file )

## In this article

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

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

Filters the `$orientation` value to correct it before rotating or to prevent rotating
the image.

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

 `$orientation`int

EXIF Orientation value as retrieved from the image file.

`$file`string

Path to the image file.

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

    ```php
    $orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file );
    ```

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

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

| Used by | Description | 
| [WP_Image_Editor::maybe_exif_rotate()](https://developer.wordpress.org/reference/classes/wp_image_editor/maybe_exif_rotate/)`wp-includes/class-wp-image-editor.php` |

Check if a JPEG image has EXIF Orientation tag and rotate it if needed.

  |

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

| Version | Description | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.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_image_maybe_exif_rotate%2F)
before being able to contribute a note or feedback.