Remove related videos on YouTube

  • mandarinaleaf
    July 17, 2020 at 11:35 pm #67240

    Hi, I need to embed a YouTube video on a single panorama, but after it ends it will show related videos and I don’t want them. I tried hiding them adding ?rel=0 at the end of the URL but it won’t work, apparently it only works with the embedding video code. But the embedding video code won’t work in the plugin!
    Can you help me please?

    Post count: 6725
    July 20, 2020 at 10:41 am #67299

    Hi mandarinaleaf,

    When pasting the YouTube URL directly, our plugin uses the oEmbed feature which automatically strips out the query strings in the URL. You’ll see the same problem when pasting the YouTube URL directly to the native WP editor.

    I’ve been doing a quick search online and found the filter below which allows you to change the rendered oEmbed URL. Just add it to your child theme’s functions.php file. Take note you’ll need to replace the handle from oembed_result to embed_oembed_html to make it work.

    If you don’t need the other query strings added you can just remove them from the second parameter like so..

    Thank you

You must be logged in to reply to this topic.