Last active
January 23, 2016 14:41
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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