Home Forums General Issues Twitter oembed is text only?


Twitter oembed is text only?

  • I’m using an ACF embed field to embed various things and noticed that tweets preview/render correctly in the editor, but the stored HTML is textonly?

    For example Tweet Embed shows up like Text only.

    The HTML returned for the field is:

    <blockquote class="twitter-tweet" data-width="550" data-dnt="true"><p lang="en" dir="ltr">We’ve just hit a rather large milestone. ACF is being used on over 2 million sites 🎉 Thank you to all our users! <a href=""></a></p>&mdash; Advanced Custom Fields (@wp_acf) <a href="">September 15, 2021</a></blockquote><script async src="" charset="utf-8"></script>

  • So the issue was that this was being displayed in a vue app which, for some reason, caused the twitter widgets.js rendering to fail probably due to timing of sorts.

    I solved this by loading the script in my template according to and triggering the widget load on $nextTick in the callback.

    window.twttr = (function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0],
        t = window.twttr || {};
      if (d.getElementById(id)) return t;
      js = d.createElement(s); = id;
      js.src = "";
      fjs.parentNode.insertBefore(js, fjs);
      t._e = [];
      t.ready = function(f) {
        this.nextTick(() => twttr.widgets.load())   
      return t;
    }(document, "script", "twitter-wjs"));
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.