Filter hook 'image_editor_default_mime_type'

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

View Source

image_editor_default_mime_type

Filter Hook
Description
Filters default mime type prior to getting the file extension.

Hook Information

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

Hook Parameters

Type Name Description
string $mime_type Mime type string.

Usage Examples

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

function my_custom_filter($mime_type) {
    // Your custom filtering logic here
    return $mime_type;
}

Source Code Context

wp-includes/class-wp-image-editor.php:401 - How this hook is used in WordPress core
<?php
 396  			 *
 397  			 * @since 3.5.0
 398  			 *
 399  			 * @param string $mime_type Mime type string.
 400  			 */
 401  			$mime_type = apply_filters( 'image_editor_default_mime_type', $this->default_mime_type );
 402  			$new_ext   = $this->get_extension( $mime_type );
 403  		}
 404  
 405  		/*
 406  		 * Ensure both $filename and $new_ext are not empty.

PHP Documentation

<?php
/**
			 * Filters default mime type prior to getting the file extension.
			 *
			 * @see wp_get_mime_types()
			 *
			 * @since 3.5.0
			 *
			 * @param string $mime_type Mime type string.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/class-wp-image-editor.php
Related Hooks

Related hooks will be displayed here in future updates.