wp_maybe_enqueue_oembed_host_js
函数
wp_maybe_enqueue_oembed_host_js ( $html )
- 参数
-
-
(string)
$html
Embed markup.- Required: 是
-
(string)
- 返回值
-
- (string) Embed markup (without modifications).
- 定义位置
-
-
wp-includes/embed.php
, line 388
-
wp-includes/embed.php
- 引入
- 5.9.0
- 弃用
- –
Enqueue the wp-embed script if the provided oEmbed HTML contains a post embed.
In order to only enqueue the wp-embed script on pages that actually contain post embeds, this function checks if the
provided HTML contains post embed markup and if so enqueues the script so that it will get printed in the footer.
function wp_maybe_enqueue_oembed_host_js( $html ) { if ( has_action( 'wp_head', 'wp_oembed_add_host_js' ) && preg_match( '/]*?wp-embedded-content/', $html ) ) { wp_enqueue_script( 'wp-embed' ); } return $html; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。