-
-
Save johnheimkes/cc1eb56be5634b7f4e5d07528f0be586 to your computer and use it in GitHub Desktop.
Add &rel=0 to Youtube oembed videos
This file contains hidden or 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 | |
| /** | |
| * Filter YouTube oEmbed to include '&rel=0' to force channel related videos | |
| * once video is complete, rather than showing user related videos. | |
| * | |
| * @param $html | |
| * @param $url | |
| * @param $args | |
| * | |
| * @return mixed | |
| */ | |
| public function youtubeOembedSrcAdjust( $html, $url, $args ) { | |
| return str_replace( '?feature=oembed', '?feature=oembed&rel=0', $html ); | |
| } | |
| add_filter( 'oembed_result', 'youtubeOembedSrcAdjust', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment