钩子文档

load_image_to_edit_path

💡 云策文档标注

概述

load_image_to_edit_path 是一个 WordPress 过滤器,用于修改当前图像编辑时返回的路径或 URL。它允许开发者在加载图像进行编辑时自定义文件路径或 URL。

关键要点

  • 过滤器名称:load_image_to_edit_path
  • 参数:$filepath(文件路径或 URL,或 false)、$attachment_id(附件 ID)、$size(请求的图像尺寸)
  • 用途:在 _load_image_to_edit_path() 函数中调用,用于检索附件文件的路径或 URL
  • 引入版本:WordPress 2.9.0

📄 原文内容

Filters the returned path or URL of the current image.

Parameters

$filepathstring|false
File path or URL to current image, or false.
$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

return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );

Changelog

Version Description
2.9.0 Introduced.