Filter hook 'load_image_to_edit'

in WP Core File wp-admin/includes/image.php at line 1165

View Source

load_image_to_edit

Filter Hook
Description
Filters the current image being loaded for editing.

Hook Information

File Location wp-admin/includes/image.php View on GitHub
Hook Type Filter
Line Number 1165

Hook Parameters

Type Name Description
resource|GdImage $image Current image.
int $attachment_id Attachment ID.
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).

Usage Examples

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

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

Source Code Context

wp-admin/includes/image.php:1165 - How this hook is used in WordPress core
<?php
1160  		 * @param resource|GdImage $image         Current image.
1161  		 * @param int              $attachment_id Attachment ID.
1162  		 * @param string|int[]     $size          Requested image size. Can be any registered image size name, or
1163  		 *                                        an array of width and height values in pixels (in that order).
1164  		 */
1165  		$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
1166  
1167  		if ( function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
1168  			imagealphablending( $image, false );
1169  			imagesavealpha( $image, true );
1170  		}

PHP Documentation

<?php
/**
		 * Filters the current image being loaded for editing.
		 *
		 * @since 2.9.0
		 *
		 * @param resource|GdImage $image         Current image.
		 * @param int              $attachment_id Attachment ID.
		 * @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).
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-admin/includes/image.php
Related Hooks

Related hooks will be displayed here in future updates.