wp_embed_handler_youtube
云策文档标注
概述
wp_embed_handler_youtube 是一个 WordPress 过滤器,用于修改 YouTube 嵌入输出的内容。它允许开发者在嵌入 YouTube 视频时自定义输出字符串。
关键要点
- 这是一个过滤器钩子,名称为 'wp_embed_handler_youtube'。
- 它接收四个参数:$embed(YouTube 嵌入输出字符串)、$attr(嵌入属性数组)、$url(原始匹配的 URL)、$rawattr(原始未修改的属性数组)。
- 主要用于自定义或扩展 YouTube 视频的嵌入处理逻辑。
注意事项
- 此过滤器在 WordPress 4.0.0 版本中引入。
- 相关函数 wp_embed_handler_youtube() 是 YouTube iframe 嵌入处理器的回调函数。
原文内容
Filters the YouTube embed output.
Description
See also
Parameters
$embedstring-
YouTube embed output.
$attrarray-
An array of embed attributes.
$urlstring-
The original URL that was matched by the regex.
$rawattrarray-
The original unmodified attributes.
Source
return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr );
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |