admin管理员组

文章数量:1391955

I am unable to successfully embed (certain) YouTube URLs into my theme in the back end, with the intention of having viewable video clips on the front end. Not sure if this a WordPress issue or an issue with the video URLs themselves. I am using Divi, but have confirmed the problem is the same with Gutenberg and the Twenty Twenty theme.

All videos in question play fine on YouTube itself.

If I choose a random trending video from YouTube, the embed works fine. If I use one of my client's videos, nothing shows up on the front end.

Example probem video from my client:

Example working video, a random video chosem from youTube:

Any ideas what might be going on?

**EDIT: Note that the issue is only for client-created videos. Random YouTube videos embed and play fine.

I am unable to successfully embed (certain) YouTube URLs into my theme in the back end, with the intention of having viewable video clips on the front end. Not sure if this a WordPress issue or an issue with the video URLs themselves. I am using Divi, but have confirmed the problem is the same with Gutenberg and the Twenty Twenty theme.

All videos in question play fine on YouTube itself.

If I choose a random trending video from YouTube, the embed works fine. If I use one of my client's videos, nothing shows up on the front end.

Example probem video from my client: https://www.youtube/watch?v=rLZhyfkgHvs

Example working video, a random video chosem from youTube: https://www.youtube/watch?v=B3MDJsggfDg

Any ideas what might be going on?

**EDIT: Note that the issue is only for client-created videos. Random YouTube videos embed and play fine.

Share Improve this question edited Feb 13, 2020 at 17:01 clg asked Feb 10, 2020 at 21:55 clgclg 31 silver badge3 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I had recently similar issue with Divi and embedding videos. At the end I realized its because oEmbed issues in WordPress sites running on host with both IPv4 and IPv6 sites.

Either you can add this code to your functions.php to fix this:

add_action( 'http_api_curl', function( $curl_handle ) {
   curl_setopt( $curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
});

Or you can download the same solution as a plugin I made - the site is in Czech Language, but it will lead to downloading very simple plugin doing the same thing

本文标签: Can39t embed certain youtube videos into theme