Skip to content

Instantly share code, notes, and snippets.

@jonschr
Created July 22, 2014 21:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonschr/b093d1904b4ece6a578b to your computer and use it in GitHub Desktop.
Save jonschr/b093d1904b4ece6a578b to your computer and use it in GitHub Desktop.
Remove related videos from youtube embeds (done via ooembed) in WordPress
//Remove related videos from youtube ooembed
add_filter('oembed_result', 'hide_youtube_related_videos', 10, 3);
function hide_youtube_related_videos($data, $url, $args = array()) {
$data = preg_replace('/(youtube\.com.*)(\?feature=oembed)(.*)/', '$1?' . apply_filters("hyrv_extra_querystring_parameters", "wmode=transparent&") . 'rel=0$3', $data);
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment