Site logo

Archived topic

YouTube Embed works fine in admin panel, shows only URL on live site

33 replies · Started by Martin on September 18, 2020

Viewing posts 16–30 of 34

Hi Zoltan,

Can you go to this website, paste the video URL there, copy the generated Embed code?
https://embedresponsively.com/

Then paste the embed code to a HTML block in the block element.

Let me know if that works

Hi Ying,

Yes, it works. Thank you for your workaround solution, however I wonder what is the reason for the Youtube Block failure (missing iframe code) when using together with GP Elements-Block. Who should be responsible to solve it, WP or GP?

KR, Zoltán

Glad it works.

I haven't had time to dig deeper on this, not sure what exact the cause is.

I have the exact same problem with not working youtube-blocks.
1. As long as I use the youtube-block in normal pages, it works fine for me in backend and also frontend. The video is displayed and everything is fine.
2. If I switch to gp-elements to build some global content, it breaks the function of the youtube-block in frontend and no video is displayed. It´s confusing, because the backend of the gp-element seems to be ok and the video is displayed.

So I also would say, there´s "something" in the way how gp-elements are working and it could be a GP problem, if normal sites are working fine, right? I hope this helps to figure out where the problem is.

And it works well, if I just use a html-block and some embedding code from https://embedresponsively.com/ like David also mentioned here.

Hi @Maik,

This issue is most likely site-specific as it doesn't occur on all user's sites. A plugin or PHP snippet is likely messing up w/ the script WordPress uses.

On a fresh site w/ minimal plugins installed (GP Premium + GenerateBlocks), the embed blocks work perfectly.

Hi Elvin.
Good to know, I'll dig deeper here too, thanks for the hint with the fresh setup, I´ll test this. (I´ve never used yt-blocks like this in a fresh setup.)

PS: My post was just another source of how it works for me and how I´ve "fixed" it for now. I just love this forum as a great source of information about every problem or question around using GP. Thanks guys, for this great work!

Yes, having a fresh install or at least having all plugins disabled gives you a baseline if the issue is a bug on WordPress core block itself or if a plugin is causing it.

No problem. Glad to be of any help.:D

Also running into this issue in the following context:

Add New Element -> Block -> Block Type = Hook (before_footer)

It seems that auto oembed is not run on this Element as it's outside of a post or page content area. Looks fine in the Element editor but on the frontend you get only a youtube URL in text format.

Hi Ying, thank you for the reply.

Yes that embed code works fine. However it's important the general Youtube/Video core block works for content editors so I'd love to sort out a longer term solution. I believe this issue may be related.

Hi there,

Can you see if adding this snippet makes a difference?:

add_filter( 'generate_do_block_element_content', function( $content ) {
    global $wp_embed;
    $content = $wp_embed->autoembed( $content );
	
    return $content;
} );

Let me know :)

That totally worked! Thanks Tom and Ying!

Glad we could help! We'll get this fixed in GPP.

This worked for me as well. Youtube embed block being used in elements as a hook was not showing the video and this fixed it. Thank you for providing the solution.

Hi I'm having the same problem -- for both YouTube videos and play lists - they will not show up in elements. My question: Where do I add the code that Tom posted?

This archived topic is closed to new replies.