Last active
August 29, 2015 14:18
-
-
Save tomfinitely/936c11d21e057e100236 to your computer and use it in GitHub Desktop.
YouTube oEmbed Filter
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
// customize embed settings | |
function custom_youtube_settings($code){ | |
if(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){ | |
$return = preg_replace("@src=(['\"])?([^'\">\s]*)@", "src=$1$2&showinfo=0&rel=0&autohide=1", $code); | |
return $return; | |
} | |
return $code; | |
} | |
add_filter('embed_handler_html', 'custom_youtube_settings'); | |
add_filter('embed_oembed_html', 'custom_youtube_settings'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment