Closed sungkhum closed 5 years ago
Can you share a specific example of a URL you're trying to embed? I am not able to reproduce. From the relevant code, it seems that there may be expected cases where if, for example, you include "www." in the URL, it would not embed.
Relevant code:
Sure, here's an example: https://youtu.be/1aUHqeCffI0
I'm still having trouble reproducing on my end. For me, it displays correctly both in the editor and on the front of the site.
Can you clarify:
Hi, I have the same issue and it appears correctly in the editor, but in the front it shows
And it shows as a simple link text
Also youtube embed blocks added in the version prior to 5.2 now show up when editing a post as unrecognized block and needs to be resolved. Had it on 5 posts this morning.
Can both of you share which plugins you have active on the site?
If only a link shows on the front of the site, it could indicate that it failed to request embed information from YouTube's oEmbed API (possible server issue, network unavailability, plugin conflict).
If you're seeing blocks shown as having unexpected content, could you open your browser's developer tools console. There should be a message logged including "Expected" and "Actual" markup for a block. Can you share that here?
:see_no_evil: I unfortunately already fixed my few posts that had the "unexpected content" issue. Will report if it happens again.
I'm still having trouble reproducing on my end. For me, it displays correctly both in the editor and on the front of the site.
Can you clarify:
Does it appear correctly in the editor? And if not, what is shown? Yes, it appears correctly in the editor.
Does it appear on the front of your site as a draft, or only when published (as your steps describe)? It appears only when I preview the post. When I publish, it no longer appears.
Can you share the theme and/or plugins you're using, in case there might be a conflict? I have a ton of plugins, using the Bimber premium theme.
If you are able to, I would suggest trying to temporarily disable plugins or switch to another theme, to be able to confirm whether or not it is a theme or plugin incompatibility.
I'm going to close this issue at the moment as it seems that we can't find ways to reproduce it. More likely a plugin incompatibility. That said, I'd be happy to reopen again if we have new details allowing us to reproduce it.
Hi, I have the same issue and it appears correctly in the editor, but in the front it shows
And it shows as a simple link text
It 's simple because your theme use $post->post_content and not "the_content()". Use the_content it will format Gutenberg code.
Hi, I have the same issue and it appears correctly in the editor, but in the front it shows
And it shows as a simple link text
It 's simple because your theme use $post->post_content and not "the_content()". Use the_content it will format Gutenberg code.
That was the problem. Thanks!
I had the same problem, none of the embed items were working, I was just seeing the link and the caption. I could solve it by using the_content()
instead of echo get_the_content()
WordPress 5.3 seems to fix this bug
No. 5.3.2 version and can´t embed youtube videos in any format. My theme uses the_content() to display.....
I was also having the same problem, using the classic editor though. I don't understand why, but all I did to solve the problem was to disable and then re-enable Classic Editor and ACF plugins. hope it helps someone.
First check for blocks in the content and after that filter the "url" from the block:
$output = ''; $blocks = parse_blocks( $content ); foreach ( $blocks as $block ) { $output .= render_block( $block ); if( "core-embed/youtube" === $block['blockName'] ) { $not_embedded = $block['attrs']['url']; $output = str_replace( $not_embedded, wp_oembed_get($not_embedded), $output ); } } echo $output;
I have found another cause for this issue—if the theme sets content_width too high, YouTube returns an error (something about width too large) that prevents the retrieval/construction of the iFrame element. WP then reverts to displaying the embed URL.
To reproduce, add the following to the theme's functions.php:
function themename_content_width() { $GLOBALS['content_width'] = apply_filters( 'themename_content_width', PHP_INT_MAX ); } add_action( 'after_setup_theme', 'themename_content_width', 0 );
The general area of code where WP sends a failed request to YouTube is:
wp-includes/class-wp-oembed.php
PHP_INT_MAX might be a bad setting for content_width, but I suspect lower values probably result in the same issue. There could be other WP users with the same problem. The main workaround is is to manually copy in an iFrame element (eg: https://wordpress.org/support/topic/youtube-videos-not-showing-in-browsers/).
This setting used to work with YouTube embeds back in early 2020. From memory, it was used to prevent banner images from being scaled down too far.
Possible fixes/improvements:
I have the same issue. In the editor, I can see the video normally, but at the frontend, just a while block is displayed (no URL, just white). I am using the Gutenberg YT embed block, but I have the same issue with the HTML YT embed code. Wordpress 6.3.1 DIVI 4.22.1 LiteSpeed Cache 5.6 ShortPixel Adaptive Images 3.8 Example: https://weltderbeamer.de/test/ At the bottom between the text is the YT video embed: Below is a video. --- Above is a video. I tried many different YT URLs. http instead https, old link, short link, etc. It all doesn't work.
Describe the bug When I embed a Youtube video in a Youtube block and publish, the Youtube video does not show up.
To reproduce Steps to reproduce the behavior:
Expected behavior The embedded Youtube video should show up in the post.
Desktop (please complete the following information):
Smartphone (please complete the following information): Any smartphone.
Additional context
** Temporary Fix If I use the classic editor and use the [embed][/embed] shortcode the youtube video embeds correctly.
** Linked bug This might be related to this bug: https://github.com/WordPress/gutenberg/issues/8411 but since it is closed, I opened a new one.