• Resolved andy_moyle

    (@andy_moyle)


    I’ve got a shortcode that successfully returns a bunch of html.
    I want any video urls in that html to get “embedded” – but can only get the url to disappear if I try
    $out=do_shortcode($out);
    I’ve tried wrapping
    https://www.youtube.com/watch?v=dQw4w9WgXcQ
    in embed tags and made sure it’s on it’s own line too.

    How do I get $out to have the embed magic happen please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The “magic” embedding happens when content is being set up for the page/post/etc, but anything output by a shortcode isn’t included in this so you need to do it yourself.

    Without testing, I think that this should work…

    $out = apply_filters ( 'the_content', $out );

    That applies the ‘the_content’ filter to your video URL, which should do the correct embedding. As I said, I haven’t tested this, but I think it should work for you.

    Thread Starter andy_moyle

    (@andy_moyle)

    Super it worked thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Video Url in shortcode return..’ is closed to new replies.