{$type}_send_to_editor_url
云策文档标注
概述
本文档介绍 WordPress 中的 {$type}_send_to_editor_url 过滤器钩子,用于过滤特定媒体类型发送到编辑器的 URL。钩子名称的动态部分 $type 指定媒体类型,如 audio、file 或 video。
关键要点
- 钩子名称:{$type}_send_to_editor_url,其中 $type 为媒体类型(如 audio、file、video)。
- 参数:$html(HTML 标记)、$src(媒体源 URL)、$title(媒体标题)。
- 用法:通过 apply_filters 调用,允许开发者修改发送到编辑器的 URL 相关数据。
- 相关函数:wp_media_upload_handler() 和 wp_ajax_send_link_to_editor() 使用此钩子处理媒体上传和 AJAX 链接发送。
- 版本历史:自 WordPress 3.3.0 版本引入。
原文内容
Filters the URL sent to the editor for a specific media type.
Description
The dynamic portion of the hook name, $type, refers to the type of media being sent.
Possible hook names include:
audio_send_to_editor_urlfile_send_to_editor_urlvideo_send_to_editor_url
Parameters
$htmlstring-
HTML markup sent to the editor.
$srcstring-
Media source URL.
$titlestring-
Media title.
Source
$html = apply_filters( "{$type}_send_to_editor_url", $html, sanitize_url( $src ), $title );
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |