Support » Fixing WordPress » Twitter Embeds Failing

  • Why can’t the Twitter tweets be embedded? The same issue is encountered on our website.

    To check if the issue is with us or on every other WordPress site, we tried WordPress demo playground – and even Tweets are not getting embedded there.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • @lehren

    Can you provide more information about what you were trying to embed and the version of WordPress you are using?

    I tested and when I tried to embed a tweet, it worked right out of the box without any issues in a WordPress blog, here’s the screenshot:

    Thread Starter lehren

    (@lehren)

    As soon as we try to embed any tweet it returns “Sorry, this content could not be embedded.”

    Using WordPress 6.2.2.

    To our surprise, it is also not working on other installations like https://developer.wordpress.org/playground/demo

    Can you please share the link of the tweet, so I can try embedding on one of my test sites running WordPress 6.2.2 and see if the issue is specifically with that tweet?

    About playground demo, it’s experimental and things may or may not work correctly in there.

    Thread Starter lehren

    (@lehren)

    We just tried with one – https://twitter.com/elonmusk/status/1662292805312495618

    At least 6 of our sites are experiencing the same issue from last 3 days.

    We understand that the demos may be experimental but then we tried an alternate test link – https://www.softaculous.com/demos/WordPress and the tweets do not get embedded here, return the same issue.

    @lehren

    Thanks for providing the link to the twitter post you’re trying to embed.

    Since you mentioned the issue is happening on your site, I tried it on different websites hosted on different platforms and locations.

    Apparently, on some of the sites its working fine, and on others its not.

    I dig a bit deeper and looked for possible issues, turns out, Twitter API for oEmbed is returning “Method Not Allowed” (header 405) when requested from some of the servers while returning the correct response for others. So I’d say, nothing is wrong at the WordPress end, but its Twitter API that’s refusing to serve some servers, while allowing others.

    To give you an idea about how oEmbed works, WordPress makes an API request to the service whose URL is going to be embedded, then based on response, the HTML markup is generated, but if those services do not respond or give any errors, WordPress cannot generate the HTML markup and gives you an error without stating what exactly happened.

    Would be great if you can contact Twitter support for this, asking why your server’s IP is not receiving the responses while other IPs are.

    brendan1029

    (@brendan1029)

    Have the exact same issue for 3 days now, tried everything to sort out the issue

    https://asknigeria.com/entertainment/recap-on-local-and-global-sport-news/

    Thread Starter lehren

    (@lehren)

    For us it is sometimes error 401 else 404 for oembed API requests when we inspect it under the browser debugger console while working on the block editor.

    We will try to reach out to twitter, lets see how it goes.

    @gagan0123 – thanks for contributing to this thread.

    @lehren

    Thanks for the follow up 🙂

    I also tried reaching out to Twitter, but where there used to be contact forms for support, now only article links are there and no form to be found on their contact us page.

    Keeping track of your request on Twitter Developers site

    I’ve encountered the same error as well. Is there any solution available?

    Resolved issue by allowlisting the Twitter API IP ranges listed here:
    https://developer.twitter.com/en/blog/product-news/2022/updated-source-ip-address-range

    mcsr

    (@mcsr)

    I’m experiencing the same issue with Twitter and Instagram. But YouTube is working fine.

    @marclouis Where did you add those IP ranges?

    Marc Kranat

    (@marclouis)

    For me it as all TCP ports inbound in the Digital Ocean Panel Firewall, others it was IPTables, I have written all I know so far here https://300m.com/security/twitter-oembed-broken-on-digitalocean/

    @marclouis I’ve tested this, but it didn’t make any effect.

    I also can’t embed my twitter feed. Any solution?

    @palmdoc I couldn’t resolve the actual issue but found a workaround for some types of posts.

    In case of Twitter posts you can go to https://publish.twitter.com/ and enter the URL of the Twitter post you want to embed. After that, you will get an <blockquote /> HTML snippet that you can copy. In Gutenberg you can embed this using the ‘Custom HTML’ (I’m not 100% sure what’s the correct English name of the block) to embed the HTML.

    If you’re using any kind of consent manager to block those embeds if the user has not acknowledged the policy, that should also work if the CMP is initialized before the embed code.

    Hope this helps.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.