currently the word press excerpt shows a youtube link if the post has a yuutube video inside.
I saw this code:
function remove_links($text)
{
if ('' == $text )
{
$pattern = '~http://[^\s]*~i'; //what we want to remove, the http link
$text = get_the_content('');
$text = preg_replace($pattern, '', $text);
}
return $text;
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'remove_links');
It does remove the you-tube links from the excerpt but it adds a duplicate excerpt on top of the one that was there. Is there a way to simply the function to just scan the current excerpts and remove any you-tube links within them?
</div>