我遇到了这个问题。
我正在通过自定义字段 here 传递它
(注意“autoplay=1”)
但是当我使用 wp_oembed_get
在我的主题上加载视频时...它可以正常显示视频,但它不会监听我的 autoplay=1
变量路过。
我需要在页面加载时播放视频。
最佳答案
我认为做到这一点的方法是使用 WordPress 过滤器:
function modify_youtube_embed_url($html) {
return str_replace("?feature=oembed", "?feature=oembed&autoplay=1", $html);
}
add_filter('oembed_result', 'modify_youtube_embed_url');
关于php - WP Oembed 未传递 “autoplay=1” 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4442758/