Filter hook 'wp_image_maybe_exif_rotate'

in WP Core File wp-includes/class-wp-image-editor.php at line 513

View Source

wp_image_maybe_exif_rotate

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

Hook Information

File Location wp-includes/class-wp-image-editor.php View on GitHub
Hook Type Filter
Line Number 513

Hook Parameters

Type Name Description
int $orientation EXIF Orientation value as retrieved from the image file.
string $file Path to the image file.

Usage Examples

Basic Usage
<?php
// Hook into wp_image_maybe_exif_rotate
add_filter('wp_image_maybe_exif_rotate', 'my_custom_filter', 10, 2);

function my_custom_filter($orientation, $file) {
    // Your custom filtering logic here
    return $orientation;
}

Source Code Context

wp-includes/class-wp-image-editor.php:513 - How this hook is used in WordPress core
<?php
 508  		 * @since 5.3.0
 509  		 *
 510  		 * @param int    $orientation EXIF Orientation value as retrieved from the image file.
 511  		 * @param string $file        Path to the image file.
 512  		 */
 513  		$orientation = apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $this->file );
 514  
 515  		if ( ! $orientation || 1 === $orientation ) {
 516  			return false;
 517  		}
 518  

PHP Documentation

<?php
/**
		 * Filters the `$orientation` value to correct it before rotating or to prevent rotating the image.
		 *
		 * @since 5.3.0
		 *
		 * @param int    $orientation EXIF Orientation value as retrieved from the image file.
		 * @param string $file        Path to the image file.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-image-editor.php
Related Hooks

Related hooks will be displayed here in future updates.