wppaste
WordPress

apply_filters( 'editor_max_image_size', int[] $max_image_size, string|int[] $size, string $context )

Since
2.5.0
Filters the maximum image size dimensions for the editor.

Compatibility

WordPress
since 2.5.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$max_image_sizeint[]
{ An array of width and height values.
@type int $0 The maximum width in pixels.
@type int $1 The maximum height in pixels.
}
  • $0int

    The maximum width in pixels.
  • $1int

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

Where this hook fires · 1

  • wp-includes/media.php:138image_constrain_size_for_editor()

Source code

	 * @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).	 */	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context ); 	return wp_constrain_dimensions( $width, $height, $max_width, $max_height );} /** * Retrieves width and height attributes using given width and height values.

Changelog

Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.