Filter hook 'editor_max_image_size'

in WP Core File wp-includes/media.php at line 138

View Source

editor_max_image_size

Filter Hook
Description
Filters the maximum image size dimensions for the editor. }

Hook Information

File Location wp-includes/media.php View on GitHub
Hook Type Filter
Line Number 138

Hook Parameters

Type Name Description
int[] $max_image_size { An array of width and height values.
string|int[] $size Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
string $context The context the image is being resized for. Possible values are 'display' (like in a theme) or 'edit' (like inserting into an editor).

Usage Examples

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

function my_custom_filter($max_image_size, $size, $context) {
    // Your custom filtering logic here
    return $max_image_size;
}

Source Code Context

wp-includes/media.php:138 - How this hook is used in WordPress core
<?php
 133  	 *                               an array of width and height values in pixels (in that order).
 134  	 * @param string       $context  The context the image is being resized for.
 135  	 *                               Possible values are 'display' (like in a theme)
 136  	 *                               or 'edit' (like inserting into an editor).
 137  	 */
 138  	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
 139  
 140  	return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
 141  }
 142  
 143  /**

PHP Documentation

<?php
/**
	 * Filters the maximum image size dimensions for the editor.
	 *
	 * @since 2.5.0
	 *
	 * @param int[]        $max_image_size {
	 *     An array of width and height values.
	 *
	 *     @type int $0 The maximum width in pixels.
	 *     @type int $1 The maximum height in pixels.
	 * }
	 * @param string|int[] $size     Requested image size. Can be any registered image size name, or
	 *                               an array of width and height values in pixels (in that order).
	 * @param string       $context  The context the image is being resized for.
	 *                               Possible values are 'display' (like in a theme)
	 *                               or 'edit' (like inserting into an editor).
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/media.php
Related Hooks

Related hooks will be displayed here in future updates.