• I have embedded a YouTube video in a blog post in the new Gutenberg block editor. In the post backend, the embedded YouTube video block looks perfect… but when I publish it and look at the live post, only the YouTube video caption appears.
    EXAMPLE: coursenvy .com/coinbase

    NOTE: It is JUST not working on blog posts. When I embed YouTube videos into new pages, they do appear on the live website page.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 16 through 30 (of 36 total)
  • I am having the same issue, but it appears to only happen with posts in 3 scenarios:
    ONLY the youtube block
    Youtube block first with other blocks after it
    Empty paragraph block first

    Only Youtube block:
    https://blog.saltyflytying.com/chicones-mr-chumlee/

    YT with text block after
    https://blog.saltyflytying.com/gt-pinfish/

    Paragraph bloc first with  
    https://blog.saltyflytying.com/chicones-tuscan-bunny/

    So try adding &nbsp to a paragraph block first or make sure your post has content. It seems YT blocks only are an issue at least for me.

    I’m having the same issue here at our WordProof site.

    It’s a repeater with both a paragraph and a YT vid.

    I have had this problem off and on since Gutenberg editor was introduced (though I only use YouTube embeds in posts).

    My two latest posts with YouTube embeds showed the video in the editor, but not in the displayed post. Strangely, earlier posts were still working, even though I had cleared the caches on both the server and my browser.

    I eventually tracked it down. On the old posts, I was using the youtu.be/???? form of the video link, while on the new ones I was using the youtube.com/v/w=????

    Hope this gives others a clue on how they might solve the problem.

    I too have this issue using the YouTube Block. Embed works fine in the Gutenberg editor, but preview and publish is missing the video.

    Any solution for this problem? I have it too :/

    I have one site where it works and another one where it doesn’t. Both use the same theme.

    But on the website where it doesn’t work I’m rendering my blocks via PHP with parse_blocks() and render_block(), I think this introduces the problem, cause the necessary JS is not included.

    If I’m right about this and if I manage to fix it and if I don’t forget I’ll post my solution here.

    I think I found the cause of the problem for most people here.

    Normally, you would render your content with <?php the_content(); ?>
    If you do this, youtube embeds should just work.

    But if you use something like <?php echo get_the_content() ?> or <?php echo $post->post_content ?> it will not.

    Or in my case, it didn’t work because I was using some custom code to get all blocks separately with $blocks = parse_blocks( $post->post_content ); and then later render the ones I need with:

    foreach ($blocks as $block) {
      echo render_block($block);
    }

    That didn’t work, because I did not use the_content(), but you can apply the the_content-filters like this:

    foreach ($blocks as $block) {
      echo apply_filters( 'the_content', render_block($block) );
    }

    Now everything works fine for me.

    Got the solution here: https://github.com/WordPress/gutenberg/issues/14080#issuecomment-567429414

    • This reply was modified 4 years, 4 months ago by Jules Colle.
    • This reply was modified 4 years, 4 months ago by Jules Colle.
    • This reply was modified 4 years, 4 months ago by Jules Colle.

    I’m also struggling with this exact same issue, but I’m using the add_filter() to do the same thing in my functions.php. However when I add echo apply_filters( ‘the_content’, render_block($block) ); to my code I get “Uncaught Error: Maximum function nesting level of ‘256’ reached, aborting!”

    //If single block exists on page or post don't show it with the other blocks
    function remove_blocks() {
    	// Check if we're inside the main loop in a post or page.
      if ( ( is_single() || is_page() ) && in_the_loop() && is_main_query() ) {
    		$blocks = parse_blocks( get_the_content() );
    		foreach ( $blocks as $block ) {
    			if ( 'lazyblock/about-section' === $block['blockName'] || 'lazyblock/about-how-help-me' === $block['blockName']) {
    				continue;
    			} else {
    				echo render_block( $block );
    			}
    		}
    	}
    }
    add_filter( 'the_content', 'remove_blocks');
    

    I really thought I finally had a way to utilize WP to the fullest but now with this youtube issue, I’m back to limited options for website layouts.

    Hi All,

    I’ve embedded my personal YouTube videos on my blog a fair bit. Only recently has it stopped working. I do the following;

    I simply add the video via Add Block > YouTube > Add URL.

    https://www.theflyingvlog.uk/new-avionics/

    On my current blog it appears as a URL. On the older Blogs, it doesn’t appear at all.

    However further down is a video from Garmin, this works fine. I looked at YouTube and where else I’ve embedded my videos, and all appears fine. Unless of course I’ve missed something?

    Thanks @jules-colle

    We use Timber and needed to switch post.post_content for post.content

    perkster74

    (@perkster74)

    I am having the same issue. I tried all the suggestions. I am using the Youtube block in the new block editor. The site is https://www.ourdownsizedlife.com. Zoom Lite is the theme.
    I have pasted the URL that youtube provides when clicking ‘Share’ in the youtube block and, in the editor, it looks fine.
    In the preview and live site, there is a space on the page where the video should display. A big white space.
    I copied and pasted the URL from the browser that shows when I click the link youtube provides into the URL space of the youtube block. That didn’t work either. I also typed in the URL in WordPress youtube block – and again, nothing. ALL works fine in the editor, but when I update and preview, just white space where the video should be.
    What I am seeing is WordPress changing what I type in. In the editor, I can paste or type in the URL from the browser and all looks good. If I right-click on the video as it is playing and click ‘copy the URL link’ from the menu, I get the original URL that youtube provides when clicking Share.
    The videos on posts that were done with Classic still work. I really don’t want to go back to Classic editor.
    Is this an open issue to be fixed?

    I am still having the issues. My blog page works fine but if I use the latest posts block on a page it displays a white space with a url instead of the video.

    I had this same problem when I tried to use a Gutenburg youtube embed block on a PAGE (not a post). Video showed fine in editor but in preview or upon publishing, the video would be replaced with the youtube url (which was not a link, just a url). After A LOT of trying different things I inadvertently discovered the cause of the problem (at least in my case). I had the embedded youtube block part of a reusable block and that caused the problem. As soon as I converted the reusable block to a regular block, the video showed up fine. Hope this helps someone else.

    I just experienced this issue. And it was JetPack. I disabled JetPack and the full functionality returned.

    I had to click on “convert to reusable block” (again) on the reusable block I added to a new site. Then it worked in both places. Hope this lasts, and can be of help to others as well:)

Viewing 15 replies - 16 through 30 (of 36 total)
  • The topic ‘Gutenberg YouTube Block Not Displaying in Posts Only’ is closed to new replies.