Home Forums General Issues Youtube Oembed field not working


Youtube Oembed field not working

  • Hello,

    We have a website with a lot of Youtube Oembed fields en most of the time they are working but for some strange reason the sometimes stop working.

    In the back-end when you paste the Youtube URL the thumb is not loaded and the video and thumb also doesnt shop on the front-end of the website.

    We have taken a copy of the website and placed this on a differtent server and for some reason the Youtube Oembed field is working there. So we are thinking it has something to do with our hosting provider.

    We allready contacted them but we want to know for sure this could be something with the hosting provider (server)

    Anyone else got this problem before? We really could use some help because this is a live website and all the video’s stopped working now.

    Thanks in advance.

    Kind regards,

  • @precies Having almost the same issue 7days+, first was thinking it was problem with Plesk – but on another Plesk install its working.

    – When you insert YouTube link – you get just Link in backend and frontend (no thumb, no video..) ?

    – Normal iframe code is working, so it isnt YouTube (block or something like that)…
    – We did try different themes (TwentyTwenty, Twenty Nineteen…)

  • Just to confirm its working on local development:
    — the same setup (plugins, theme… 99.9% the same content – clone)

  • @apsolut

    We fixed the issue by placing the iframe link in another ACF. We did a lot of debugging with our hosting provider and it is because of the API requests you are doing to YoutTube.

    The way we loaded video’s on the front-end did to many requests getting the YouTube thumbnail. Everytime a visitor visits that page there was a request to youtube getting the thumbnail of the video, that is why we were blocked.

    Maybe this wil help you solving your problem? How do you load the video’s in the Front-end?

    Maybe you can post some code?

  • @precies (would be hard to block one video and allow the same video on the same domain, but change in API or Code could be possible)..

    Looks like its not an ACF issue, using default WP oEmbed error is there:
    wp-json/oembed/1.0/proxy? 404
    {"code":"rest_forbidden","message":"Sorry, you are not allowed to make proxied oEmbed requests.","data":{"status":401}}

    – ACF some 5.x, old versions and latest
    – PHP versions: 7.2, 7.3, 7.4
    – WordPress version 5.2.1, …latest
    – Themes: TwentyTwenty, TwentyNineteen, Storefront themes

  • @precies scope of IPs was blocked , and we were in that scope.

    – easiest way for testing response to see is IP blocked, was login via SSH curl
    – when you are not blocked, there will be more than 10lines of response…

  • Same problem here, I’m subscribing to this topic. It happens on both a local and a live web server. In this case it’s regarding Spotify embeds.

  • We have exactly the same problem and that’s because WordPress creates the player via the admin-ajax.php, resulting in that the request to the youtube oembed API comes from your server and not from your computer.

    We host our WordPress Sites ourselves and we have 100+ sites running on our server. Some sites are heavily using ACF oEmbed.

    Because WordPress handles the oembed request itself youtube gets a lot of requests from our server IP and we are hitting the quota limit.

    This is the result of the curl:

    <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>302 Moved</TITLE></HEAD><BODY>
    <H1>302 Moved</H1>
    The document has moved
    <A HREF="">here</A>.

    My take would be that ACF could enable an option to store the complete oembed response from google in the postmeta instead of only saving the entered url. With this, the frontend does not have to request the youtube oembed api everytime a uncached version of the site is loaded.

    Is this realistic?

  • In the meantime I made some researches and found out that the ACF Oembed Field does not seem to cache any of the oembed requests. I already filed a support ticket. 🙂

  • I think I’m experiencing the same issue.

    When using

    <div class="video-embed-container">
    <?php the_field('featured_video'); ?>

    In a template only the the div gets output, but when editing the post in the admin area, the preview appears as per normal.

    Is there an alternative way to embed videos (other than manually pasting the supplied IFRAME)?

    Edit: If I paste the youtube link into the regular content editor it works normally. The preview appears in the editor and also normally when viewed on the website.

  • Just +1 this for visibility. I have a site with dozens of HTML embed codes in the posts that we are moving over to ACF Embed fields, and after editing around a dozen, the thumbnails stopped working on the backend, and on the frontend we just see a URL link and not an embed.

  • My issue turned out to be the code I was using. The current postID available wasn’t the one I expected to be. Adding the expected postID had me up and running.

  • I am running into this same issue on a site with only a couple of embeds.

  • Still having same error on many wp websites on diferent ecosystems. I see this thread was created 10months ago. We are paying for a premium support, I have to resolve by my self, then not using oembed feature. Any answers?

  • We figured out that the oemebed functions aren’t cached so we wrote a simple snippet to enable transient cache for oembeds. Possibily not the best solution out there but it works on all our WordPress installations (100+):

    if( !defined('PIX_OEMBED_CACHE_KEY') ) {
                define('PIX_OEMBED_CACHE_KEY', 'pix_oembed_');
            function _wp_custom_oembed_cache_key($url, $args) {
                $args_serialized = serialize($args);
                return PIX_OEMBED_CACHE_KEY . md5("{$url}-{$args_serialized}");
            * This function caches the result
            function pix_cache_wp_oembed_get_function($data, $url, $args) {
                set_transient( _wp_custom_oembed_cache_key($url, $args), $data, 14*DAY_IN_SECONDS);
                return $data;
            add_filter('oembed_result', 'pix_cache_wp_oembed_get_function', 999, 3);
            * This function serves the cached result
            function pix_serve_wp_oembed_get_function($result, $url, $args) {
                if(trim($url) === '') {
                    return '';
                if($cached_result = get_transient(_wp_custom_oembed_cache_key($url, $args))) {
                    return $cached_result;
                return $result;
            add_filter('pre_oembed_result', 'pix_serve_wp_oembed_get_function', 2, 3);

    Feel free to let me know if it works for you!

  • This is a user forum. If you want support from the developer you need to contact here

  • Hi Adrian, we were experiencing these issues too in the last couple of weeks, just tested the snippet you shared on our end and it does the job! Thanks so much for sharing it!

Viewing 17 posts - 1 through 17 (of 17 total)

The topic ‘Youtube Oembed field not working’ is closed to new replies.