load_image_to_edit_attachmenturl
Filter HookDescription
Filters the path to an attachment's URL when editing the image. The filter is only evaluated if the file isn't stored locally and `allow_url_fopen` is enabled on the server.Hook Information
File Location |
wp-admin/includes/image.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1228 |
Hook Parameters
Type | Name | Description |
---|---|---|
string|false
|
$image_url
|
Current image URL. |
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_attachmenturl
add_filter('load_image_to_edit_attachmenturl', 'my_custom_filter', 10, 3);
function my_custom_filter($image_url, $attachment_id, $size) {
// Your custom filtering logic here
return $image_url;
}
Source Code Context
wp-admin/includes/image.php:1228
- How this hook is used in WordPress core
<?php
1223 * @param string|false $image_url Current image URL.
1224 * @param int $attachment_id Attachment ID.
1225 * @param string|int[] $size Requested image size. Can be any registered image size name, or
1226 * an array of width and height values in pixels (in that order).
1227 */
1228 $filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
1229 }
1230
1231 /**
1232 * Filters the returned path or URL of the current image.
1233 *
PHP Documentation
<?php
/**
* Filters the path to an attachment's URL when editing the image.
*
* The filter is only evaluated if the file isn't stored locally and `allow_url_fopen` is enabled on the server.
*
* @since 3.1.0
*
* @param string|false $image_url Current image URL.
* @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.