自动嵌入帖子中的Wordpress 5.2 YouTube视频无法正常工作 [英] Wordpress 5.2 YouTube video auto-embed in posts is not working

查看:61
本文介绍了自动嵌入帖子中的Wordpress 5.2 YouTube视频无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的个人Wordpress博客(5.2)中,无法自动嵌入视频.编辑器会显示一个微调器(非常简短),然后在后端显示指向视频的链接,在前端显示为纯文本的URL.

In my personal Wordpress blog (5.2), the auto-embed for videos does not work. The editor shows a spinner (very briefly), but then it shows the link to the video in the backend and the URL in plain text in the frontend instead.

我尝试过在不同的浏览器中更改帖子(均失败),尝试了不同的视频-其中一些来自vimeo(无作用).当我在HTML编辑器中使用YouTube提供的iframe嵌入代码作为帖子时,在同一帖子中可以使用完全相同的视频.

I've tried changing the post in different Browsers (all failed), I tried different videos - some from vimeo (none works). When I use the iframe embed-code provided by YouTube in the HTML-editor for the post the exact same video works fine in the same post.

我已禁用了所有插件,并切换到原始主题,但这无济于事,自动嵌入仍然无法正常工作.

I've disabled all plugins and switched to the original theme, but that did not help, the auto-embed still does not work.

似乎知道它应该创建一个embed元素(由它为前端生成的代码判断),但显然没有做到:

It seems to know its supposed to create an embed element (judged by the code it generates for the frontend), but fails to do so apparently:

<div>
<!-- wp:core-embed/youtube {"url":"https://www.youtube.com/watch?v=ioZX_pJz-Cc","type":"video","providerNameSlug":"youtube","className":""} -->
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube">
<div class="wp-block-embed__wrapper">https://www.youtube.com/watch?v=ioZX_pJz-Cc</div>
</figure>
<!-- /wp:core-embed/youtube -->
</div>

我不知道下一步该怎么做,这让我发疯,所以我们将不胜感激.

I have no idea what to try next, and it's driving me nuts, so help would be highly appreciated.

衷心感谢,卢卡斯

推荐答案

可能有多种原因.让我说一下其中的一些:

There might be multiple causes. Let me state some of them:

  • 您可以尝试使用YouTube短网址 https://youtu.be/ioZX_pJz-Cc .使用短网址也有同样的问题.
  • 如果使用 echo get_the_content()代替 the_content(); ,则可能不会生成嵌入代码.
  • 有时插件在使用WP挂钩时会相互冲突.覆盖模板文件中的所有冲突:<?php echo apply_filters('the_content',get_the_content());?>
  • 显然将WP核心和插件更新为最新版本也可能会有所帮助.无论古腾堡如何看待,它仍然是越野车.
  • you can try Youtube short URL https://youtu.be/ioZX_pJz-Cc instead. I had the same issue, using the short URL helped.
  • if echo get_the_content() is used instead of the_content();, embed code might not be generated.
  • sometimes plugins conflict with each other while using WP hooks. Override all conflicts in the template file: <?php echo apply_filters( 'the_content', get_the_content() ); ?>
  • obviously updating WP core and plugins to the latest version might help as well. No matter how Gutenberg is perspective, it still buggy.

信用: https://github.com/WordPress/gutenberg/issues/8411

这篇关于自动嵌入帖子中的Wordpress 5.2 YouTube视频无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆