Filter hook 'load_image_to_edit_path'

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

View Source

load_image_to_edit_path

Filter Hook
Description
Filters the returned path or URL of the current image.

Hook Information

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

Hook Parameters

Type Name Description
string|false $filepath File path or URL to current image, or false.
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_path
add_filter('load_image_to_edit_path', 'my_custom_filter', 10, 3);

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

Source Code Context

wp-admin/includes/image.php:1241 - How this hook is used in WordPress core
<?php
1236  	 * @param string|false $filepath      File path or URL to current image, or false.
1237  	 * @param int          $attachment_id Attachment ID.
1238  	 * @param string|int[] $size          Requested image size. Can be any registered image size name, or
1239  	 *                                    an array of width and height values in pixels (in that order).
1240  	 */
1241  	return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
1242  }
1243  
1244  /**
1245   * Copies an existing image file.
1246   *

PHP Documentation

<?php
/**
	 * Filters the returned path or URL of the current image.
	 *
	 * @since 2.9.0
	 *
	 * @param string|false $filepath      File path or URL to current image, or false.
	 * @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.