Last active
July 19, 2019 20:25
-
-
Save davekuhar/36d339ea401cdd876f471a9db88e97e3 to your computer and use it in GitHub Desktop.
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
/* remove pesky youtube links from post excerpts */ | |
add_filter('wpv_filter_post_excerpt', 'xmit_remove_youtubelinks'); | |
function xmit_remove_youtubelinks($excerpt){ | |
return $excerpt = preg_replace('~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@?&%=+\/\$_.-]*~i', '', $excerpt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment