0

So i want to use a youtube embed plugin instead of default wordpress embed.

I disable the default youtube embed and add a str replace to remove the youtube url just leaving the video id. And i need to wrap that in a shortcode.

Basicly how do i add a shortcode end bracket in the function.

Here is what i have got so far :)

remove_filter( 'the_content', array( $GLOBALS['wp_embed'], 'autoembed' ), 8 );

function replace_content($content)
{
$content = str_replace('https://www.youtube.com/watch?v=', '[youtube', $content);
return $content;
}
add_filter('the_content','replace_content');
  • What YouTube embed plugin are you using? And how does it structure it's shortcode arguments? – disinfor Feb 16 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.