WordPress filter hook · part of WordPress core

wp_image_maybe_exif_rotate

A WordPress core filter that 7 plugins also fire themselves, running on 54K+ sites between them.

“This filter is documented in wp-includes/class-wp-image-editor.php”

How to use wp_image_maybe_exif_rotate

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wp_image_maybe_exif_rotate', function( $orientation, $file_path ) {
	// Change $orientation here.
	return $orientation;
}, 10, 2 );

Argument names come from QuickWebP's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

7 plugins that fire wp_image_maybe_exif_rotate

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Easy MCP AI icon Easy MCP AI40,000+ installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $path ) includes/cli-router/handlers/class-media-handler.php:860
  2. QuickWebP icon QuickWebP8,000+ installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $file_path ) admin/class-image-optimizer.php:1303
  3. WPMasterToolKit (WPMTK) icon WPMasterToolKit (WPMTK)5,000+ installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $file_path ) admin/modules/core/class-media-encoder.php:2434
  4. TheDock Media icon TheDock Media500+ installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $file ) includes/class-resolver.php:57
  5. Image Quality Control icon Image Quality Control400+ installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $source_filename ) includes/trait/trait-stillbe-image-editor-common-append.php:280
  6. ThemeREX Smart Media Optimizer icon ThemeREX Smart Media OptimizerFewer than 10 installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $filepath ) includes/optimizer/class-image-processor.php:206
  7. Blinkimg Image Optimizer: Convert to WebP & AVIF, Compress Images, Same Quality icon Blinkimg Image Optimizer: Convert to WebP & AVIF, Compress Images, Same QualityFewer than 10 installs apply_filters( 'wp_image_maybe_exif_rotate', $orientation, $file ) includes/pipeline/class-restorer.php:1128

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.