image_send_to_editor_url
云策文档标注
概述
image_send_to_editor_url 是一个 WordPress 过滤器,用于修改发送到编辑器中的图像 URL 和相关 HTML 标记。它允许开发者在图像插入编辑器时自定义其 HTML 输出。
关键要点
- 这是一个过滤器 Hook,名称为 image_send_to_editor_url。
- 接收参数包括 HTML 标记、图像源 URL、alt 文本和对齐方式。
- 在 wp_media_upload_handler() 函数中使用,处理媒体上传过程。
- 自 WordPress 2.8.0 版本引入。
代码示例
$html = apply_filters( 'image_send_to_editor_url', $html, sanitize_url( $src ), $alt, $align );
原文内容
Filters the image URL sent to the editor.
Parameters
$htmlstring-
HTML markup sent to the editor for an image.
$srcstring-
Image source URL.
$altstring-
Image alternate, or alt, text.
$alignstring-
The image alignment. Default
'alignnone'. Possible values include'alignleft','aligncenter','alignright','alignnone'.
Source
$html = apply_filters( 'image_send_to_editor_url', $html, sanitize_url( $src ), $alt, $align );
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |