Last active
December 21, 2015 15:09
-
-
Save joshuafredrickson/6325062 to your computer and use it in GitHub Desktop.
Wordpress: Add wmode to Wordpress embeds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fix embed wmode | |
add_filter( 'embed_oembed_html', 'op_add_video_wmode', 10, 3); | |
function op_add_video_wmode($html, $url, $attr) { | |
if ( strpos( $html, "<embed src=" ) !== false ) { | |
return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); | |
} elseif ( strpos ( $html, 'feature=oembed' ) !== false ) { | |
return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html ); | |
} else { | |
return $html; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment