2

Ok, so I want to embed youtube videos but also remove the annoying annotations. The following code works great from to embed the video

[embed width="599" height="360"]youtube.com/watch?v=mNf0v2WkV0U [/embed]

But whatever I seem to do, I cannot add the following parameter:

iv_load_policy=3

Im not sure if its even possible to to add this within the wordpress embed code? I then found something intresting:

$('object').each(function(){ 
    var $param = $(this).children(':first-child'); 
    var newUrl = $param.attr('value') + '&iv_load_policy=3'; 
    $param.attr('value', newUrl); 
});

The above code is meant to set all youtube videos globally (iv_load_policy=3) but i think Im doing it wrong.

Thanks in advance.

1

2 Answers 2

2

It doesn't look like load policies are configurable with WP's auto-embed.

But see the docs on how to use WP's embedding: http://codex.wordpress.org/Embeds

And see the Developer Resources and API at WP: http://developer.wordpress.com/docs/oembed-provider-api/

WP's auto-embedding uses oEmbed, and the specs and API are here: http://oembed.com/

7
  • +1 But some notes: Just adding links is considered "poor quality". Please always provide some code or example for your answer. Thanks.
    – kaiser
    Jul 26, 2012 at 18:50
  • True, but I think those links have a long life span, being mostly at wp.org. Jul 26, 2012 at 20:03
  • Hi, I seen the embeds page on WP last night, but couldnt make out how to add "iv_load_policy=3". I dont see it mentioned anywhere (only seems to be video size etc) Thats why I thought if I use the function code I would effectivly skip that whole step. But the function code wasnt working...so Im stuck :/ Thanks for the advice so far guys Jul 26, 2012 at 20:12
  • Got it working using an iframe, is that a good method to be using? I dread to think after 100s of post I would need to change it all again. Here is what Im using incase anybody else is looking for it <iframe width="560" height="315" src="youtube.com/embed/…" frameborder=”0″></iframe> Jul 27, 2012 at 0:11
  • Odd thing is the captions still appear in mobile but are removed when you go fullscreen. Weird, but I suppose its better than nothing. Even odder thing, I was using the same url earlier for testing and when I used another it working first time, I cant spot the difference <iframe width="560" height="315" src="youtube.com/embed/…" frameborder=”0″></iframe> Jul 27, 2012 at 0:13
2

Managed to do it,

<iframe frameBorder="0" probably_logged_in="0" width="599" height="360" src="youtube.com/embed/…; frameBorder="0">

(the B in border must be caps) probably_logged_in=0 (removes the watch later button, as long as the user isnt logged in) modestbranding=1 (removes youtube logo) rel=0 (removes related videos at the end of your video) &vq=hd720 (this one forces hd, unlike hd=1 which goes by iframe height)

1
  • FYI: "rel=0" no longer drops related videos. Per YT docs, it simply shows related videos FROM THE CHANNEL as the embedded one. (Still a plus in my book).
    – gregturn
    Mar 11, 2021 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.