Support » Fixing WordPress » Facebook Video oEmbed Not Working

  • Resolved InHouse

    (@inhouse)


    Hello, we just noticed that Facebook videos will not auto embed (oembed) in the main content editor (classic editor) or an Advanced Custom Fields “oembed field”. I’ve verified this on multiple sites with the Twenty Nineteen theme with NO plugins active except Classic Editor. I’ve tried lots of Facebook videos from different business pages (all public videos). YouTube embeds work fine. Facebook videos were working as of last week.

    To be clear, anything embedded prior to this week is still working fine but if I update any existing page/post with a Facebook embed, it breaks and only displays the plain link.

    Did Facebook or WordPress break anything? I’d love to hear others experience using a brand new embed in their environments. Thanks in advance for any help!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I can confirm this is the case with every Facebook oEmbed link – the problem is the oEmbed fetch from Facebook takes longer than the default timeout that WordPress has set.

    To fix this (until WordPress does at least), put this code in your functions.php:

    function my_increase_oembed_timeout($args) {
    	$args["timeout"] = 30;
    	return $args;
    }
    add_filter( 'oembed_remote_get_args', 'my_increase_oembed_timeout');
    • This reply was modified 6 months, 1 week ago by Biranit.

    Thank you Biranit, I was having the same issue with Instagram oEmbeds as well and your code fixed it too.

    @biranit I specially register to say thanks to you! I spent two days on this nonsense. Instagram and Facebook didn’t worked normally for me.

    Increasing timeout increases page load time, so be careful with that, it can hit rankings.

    Also, oembed cache is 24h, to play with it, some info could help here:
    https://wordpress.stackexchange.com/questions/203537/how-can-i-clear-oembed-caches-for-youtube-on-posts-as-they-are-loaded

    InHouse

    (@inhouse)

    Oh wow, I just saw these replies. No email notification on this thread for some reason.

    Thanks so much @biranit for the function! Does this work for the admin as well? I’m still experiencing the issue when attempting to embed in a post and an ACF oembed field. Both fail to embed so the front-end is a non-issue. I increased the time to 60 but they’re not embedding.

    Here’s a video of me attempting to embed the video in an oembed custom field: https://www.dropbox.com/s/86g9x52aukrutf3/Screen%20Recording%202019-05-14%20at%203.29.13%20PM.mov

    Biranit

    (@biranit)

    @inhouse oembed works the same in the admin and the frontend, so it should solve your issue in both places. I am not familiar with ACF, though: perhaps they use a different oembed functionality than the built-in WordPress one. I recommend you contact them on their support forum.

    Good luck 🙂

    InHouse

    (@inhouse)

    Ah, this is working now. May have been seeing the oembed cache as @cockyduck mentioned. Once I added ‘www’ to the URL it finally resolved (although it took a long time). Thanks again all for the help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Facebook Video oEmbed Not Working’ is closed to new replies.