load_image_to_edit_filesystempath
云策文档标注
概述
load_image_to_edit_filesystempath 是一个 WordPress 过滤器,用于在编辑图像时修改附件文件的路径。该过滤器适用于除 'full' 尺寸外的所有图像尺寸。
关键要点
- 过滤器名称:load_image_to_edit_filesystempath
- 用途:过滤附件文件路径,当编辑图像时调用
- 参数:$path(当前图像路径字符串)、$attachment_id(附件 ID 整数)、$size(请求的图像尺寸,可以是注册的尺寸名称或宽度和高度的像素数组)
- 应用场景:在 _load_image_to_edit_path() 函数中使用,位于 wp-admin/includes/image.php
- 版本历史:自 WordPress 3.1.0 引入
原文内容
Filters the path to an attachment’s file when editing the image.
Description
The filter is evaluated for all image sizes except ‘full’.
Parameters
$pathstring-
Path to the current image.
$attachment_idint-
Attachment ID.
$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).
Source
$filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |