Latest Tech and Tips

How to Prevent Youtube oEmbed from Overriding your WordPress Content


Have you ever before been to a website where you observe that media aspects such as YouTube video clips bypass various other content? This can take place if you have fall food selections, drifting bars, lightbox popups and so on In this write-up, we will certainly reveal you how to prevent YouTube oEmbed from overriding your WordPress content.


Youtube oEmbed issue

When you installed a video clip in WordPress, by default it does not have wmode= clear worth. What that suggests is that video clip aspects have the greatest concern and also it will certainly bypass any type of drifting or vibrant component.

This obtains truly frustrating. So allow’s have a look at how to include? wmode= clear to YouTube video clips in WordPress without utilizing the awful iFrames approach.

All you have to do is open your style’s functions.php data or even better your website’s plugin data and also paste the complying with code:

 feature add_video_wmode_transparent($ html, $link, $attr) {

if (strpos( $html, "<embed src=")!== incorrect )
{return str_replace('< < installed', '< < param name ="wmode" worth ="opaque"><>  < embed wmode ="opaque" ', $html);}
elseif (strpos ($ html, 'attribute= oembed')!== incorrect )
{return str_replace( 'attribute= oembed', 'attribute= oembed&& wmode= opaque', $html );}
{return $html;}
add_filter( 'em bed_oembed_html', 'add_video_wmode_transparent', 10, 3);