Skip to content

Instantly share code, notes, and snippets.

@john-kamau01
Forked from mustardBees/functions.php
Created January 22, 2021 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-kamau01/88d3c983e229eed807bf7cbb2b4c28e9 to your computer and use it in GitHub Desktop.
Save john-kamau01/88d3c983e229eed807bf7cbb2b4c28e9 to your computer and use it in GitHub Desktop.
Filter a few parameters into WordPress YouTube oEmbed requests. Enable modest branding which hides the YouTube logo. Remove the video title and uploader information. Prevent related videos from being shown once the video has played.
<?php
/**
* Filter a few parameters into YouTube oEmbed requests
*
* @link http://goo.gl/yl5D3
*/
function iweb_modest_youtube_player( $html, $url, $args ) {
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html );
}
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 );
@john-kamau01
Copy link
Author

Thanks for this. It worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment