admin管理员组文章数量:1333201
I am using this code to replace youtube video:
add_filter('embed_oembed_html', 'foo_embed_oembed_html', 99, 4);
add_filter('video_embed_html', 'foo_embed_oembed_html');
function foo_embed_oembed_html( $cache, $url, $attr, $post_ID ) {
if ( false !== strpos( $url, 'youtube' ) ) {
if ( preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches)) {
// return my shortcode
}
}
This works well with this example:
But the function foo_embed_oembed_html is not even called if I use this:
What would be the reason?
本文标签: plugin developmentReplace youtube embed in wordpress
版权声明:本文标题:plugin development - Replace youtube embed in wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742241295a2438849.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论