Skip to content

Instantly share code, notes, and snippets.

@joshuafredrickson
Last active December 21, 2015 15:09
Show Gist options
  • Save joshuafredrickson/6325062 to your computer and use it in GitHub Desktop.
Save joshuafredrickson/6325062 to your computer and use it in GitHub Desktop.
Wordpress: Add wmode to Wordpress embeds
// 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