Skip to content

Instantly share code, notes, and snippets.

@hostz-frank
Last active January 23, 2016 14:41
Show Gist options
  • Save hostz-frank/8fb1566a507c1ed15e11 to your computer and use it in GitHub Desktop.
Save hostz-frank/8fb1566a507c1ed15e11 to your computer and use it in GitHub Desktop.
Do not show related YouTube videos when using the oembed feature of WordPress - put the code into functions.php of your theme or into a custom plugin.
<?php
/**
* Youtube-Video verbieten, related vids am Ende anzuzeigen.
*/
add_filter( 'oembed_dataparse', 'this_add_youtube_norel', 11, 3 );
function this_add_youtube_norel( $return, $data, $url ) {
if( false !== strpos( $return, 'youtube.com' ) )
return str_replace( '=oembed', '=oembed&rel=0', $return );
else
return $return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment