WP Oembed没有通过"autoplay = 1"变量 [英] WP Oembed not passing through the “autoplay=1” variable

查看:176
本文介绍了WP Oembed没有通过"autoplay = 1"变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个问题.

我正在通过此处

(notice the "autoplay=1")

但是当我使用wp_oembed_get将视频加载到主题上时...会很好地显示视频,但不会收听我正在传递的autoplay=1变量.

But when I load the video on my theme using wp_oembed_get... it displays the video fine, but it does not listen to the autoplay=1 variable I am passing through.

我需要在页面加载时播放视频.

I need the videos to play on the load of the page.

推荐答案

我认为这样做的方法是使用wordpress过滤器:

I think the way to do it is using wordpress filters:

function modify_youtube_embed_url($html) {
    return str_replace("?feature=oembed", "?feature=oembed&autoplay=1", $html);
}
add_filter('oembed_result', 'modify_youtube_embed_url');

这篇关于WP Oembed没有通过"autoplay = 1"变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆