wp_embed_handler_youtube
函数
wp_embed_handler_youtube ( $matches, $attr, $url, $rawattr )
- 参数
-
-
(array)
$matches
The RegEx matches from the provided regex when calling wp_embed_register_handler().- Required: 是
-
(array)
$attr
Embed attributes.- Required: 是
-
(string)
$url
The original URL that was matched by the regex.- Required: 是
-
(array)
$rawattr
The original unmodified attributes.- Required: 是
-
(array)
- 返回值
-
- (string) The embed HTML.
- 定义位置
-
-
wp-includes/embed.php
, line 242
-
wp-includes/embed.php
- 引入
- 4.0.0
- 弃用
- –
YouTube iframe嵌入处理回调。
捕捉那些不能被oEmbed解析的YouTube iframe嵌入的URL,但可以被翻译成一个可以解析的URL。
function wp_embed_handler_youtube( $matches, $attr, $url, $rawattr ) { global $wp_embed; $embed = $wp_embed->autoembed( sprintf( 'https://youtube.com/watch?v=%s', urlencode( $matches[2] ) ) ); /** * Filters the YoutTube embed output. * * @since 4.0.0 * * @see wp_embed_handler_youtube() * * @param string $embed YouTube embed output. * @param array $attr An array of embed attributes. * @param string $url The original URL that was matched by the regex. * @param array $rawattr The original unmodified attributes. */ return apply_filters( 'wp_embed_handler_youtube', $embed, $attr, $url, $rawattr ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。