Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Corrective code for WordPress YouTube oEmbed on a webpage that has CSS transform translate.
// add parameter html5=1 to oembed YouTube requests as per
// using modified version of code on
add_filter( 'oembed_result', 'youtube_oembed_html5_parameter', 10, 3);
function youtube_oembed_html5_parameter($data, $url, $args = array()) {
// add &html5=1 parameter
$data = preg_replace('/(youtube\.com.*)(\?feature=oembed)(.*)/', '$1?' . apply_filters("hyrv_extra_querystring_parameters", "feature=oembed&amp;html5=1&amp;") . 'rel=0$3', $data);
return $data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment