• Resolved tobiasber

    (@tobiasber)


    Shortly ago the shortcodes for YouTube embeds stopped working. Have there been any changes?

    Shortcode: [youtube url=https://www.youtube-nocookie.com/watch?v=VIDEO-LINK&rel=0] (URL changed in this post)

    We ve been using these codes since around 2014 with the old WordPress Editor and the block editor. For privacy reasons we ve changed the Url to the no cookie version.

    We use the rel=0 because we do not want related videos to show. Is this still working?

    Is it true that rel=0 would not work for logged in users? Since (probably) most people are logged in into their google accounts, this function could be quite useless.

    Thank you very much

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator James Huff

    (@macmanx)

    You haven’t needed shortcodes to embed YouTube videos for quite some time: https://wordpress.org/documentation/article/youtube-embed/

    I’m curious if it works for you without the shortcode, by just pasting the URL into a YouTube Block as detailed in the support doc linked to above.

    If you’re using the Classic Editor, you still don’t need shortcodes, you can just paste the URL on any blank link to create an embed.

    Thread Starter tobiasber

    (@tobiasber)

    Thank you, James. I know about that block.

    Edit: Pasting the link into classic editor does not create an embed with the no-cookie URL (which works in the YouTube Block).

    The pages/posts are written in the classic editor. Changing them to block editor would require some effort, changing lots of pages.

    Is the Youtube shortcode no longer supported?

    • This reply was modified 1 year ago by tobiasber.
    Moderator James Huff

    (@macmanx)

    You can also just paste the YouTube video URL onto an empty line to embed it in the Classic Editor, no short code needed.

    Does that work when you try it?

    Thread Starter tobiasber

    (@tobiasber)

    Pasting the link into classic editor works with “normal YT-Links” but does not create an embed with the no-cookie URL (which works in the YouTube Block).

    Is the Youtube shortcode no longer supported in general? … Or is it an error on our website?

    Moderator James Huff

    (@macmanx)

    The YouTube shortcode should still work, I just wanted to test with the modern embed flow just to make sure it wasn’t a problem specific to shortcodes.

    But, that is interesting. YouTube views their embeds as a great way to collect data all over the web, and I wonder if they’ve shut down embedding over the no-cookie option because of it, maybe even related to their agressive anti-adblock push.

    Can you test this by creating a normal .html page on your server and adding YouTube’s standard embed code with no-cookie? (of course, if it’s not even possible to create a standard embed code with no-cookie, than that would explain it, as it would mean YouTube has shut down that possibility for embeds)

    Thread Starter tobiasber

    (@tobiasber)

    Thank you very much…

    i ve tested the html file with no-cookie embed. it works

    no cookie works in the youTube block

    i ve tested the shortcode on different wordpress websites:

    WordPress.com: Shortcode works

    Selfhosted WordPress (same Provider): Shortcode does not work on three websites but does work on the fourth (a testing website which has no SSL) this is the only difference it could make out.
    On the other website, the WP version and plugins had not been updated in some time… so the problem with the shortcode is probably not cause by recent updates.

    Probably the only way is to change all the pages/posts to the block editor

    Thread Starter tobiasber

    (@tobiasber)

    the youtube block works, even with no-cookie…. but the rel=0 (to prevent showing Videos from other channels) will not work. Videos in the youtube block will present other videos (thumbnails) when paused and at the end

    Moderator James Huff

    (@macmanx)

    Ah, it appears the lack of support for rel=0 is intentional.

    Here’s the latest: https://core.trac.wordpress.org/ticket/41012#comment:2

    Thread Starter tobiasber

    (@tobiasber)

    They ve changed, what rel=0 does: https://developers.google.com/youtube/player_parameters?hl=en#autoplay

    “After the change, you will not be able to disable related videos. Instead, if the rel parameter is set to 0, related videos will come from the same channel as the video that was just played.”

    I ll need to test embeds in iframe, not in the YouTube block

    Moderator James Huff

    (@macmanx)

    If you can make the embed work in an iframe on a static HTML file, but not in the YouTube blog, please do file this by following the steps at https://make.wordpress.org/core/handbook/testing/reporting-bugs/

    Thread Starter tobiasber

    (@tobiasber)

    the youtube block works, but not with rel=0. That parameter is not respected
    Edit: I mean, the youtube block will display an embedded video. But the function of rel=0 will not be respected. So the embedded video will show related videos from other channels. which is not always desired

    • This reply was modified 1 year ago by tobiasber.
    Moderator James Huff

    (@macmanx)

    As you said you tried before, please try an HTML embed for the YouTube iframe including rel=0 on a static HTML page.

    If that doesn’t work, the issue is on YouTube’s end, and they’ve locked down rel=0 again (either intentionally or accidentally).

    If that does work, file a bug report for WordPress following these steps: https://make.wordpress.org/core/handbook/testing/reporting-bugs/

    Please make sure that you reference https://core.trac.wordpress.org/ticket/41012#comment:2 and use your static HTML test page as proof that rel=0 should still work.

    Thread Starter tobiasber

    (@tobiasber)

    Embedding via iframe in Block Editor works with rel=0 and works with No-cookie.

    Moderator James Huff

    (@macmanx)

    It looks like a developer has already replied to you at https://core.trac.wordpress.org/ticket/59936 so please continue there if you have any further questions.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Youtube Shortcodes for embedded Videos not working’ is closed to new replies.