The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Twitter embeds not working in 3.4 (27 posts)

  1. justted
    Posted 4 years ago #


    I just updated to 3.4 and I cannot get twitter embeds to work. I went to the twenty-eleven theme and disabled all plugins, thinking there was a conflict, but I still get just the URL displayed on the post. I have emptied the browser cache and tried a different browser just in case (Chrome and Safari)

    I've tried it with both the http and https, for example:




    Any clue what could be going on here?


  2. Rev. Voodoo
    Posted 4 years ago #

    A bit of a guess here, but embeds never seem to work for me.

    I find that when I go to edit the post (whether a twitter or a youtube embed), I switch over to html view and the URL has been auto wrapped by a link, so it looks like:

    <a href="https://twitter.com/BarackObama/status/213085892846424067">https://twitter.com/BarackObama/status/213085892846424067</a>

    And it just displays as a link. If, while in html mode, I manually delete the wrapper so it's just my original URL again, and publish, my embeds work fine.\

    Give that a try and see if it helps perhaps?

    Posted 4 years ago #

    ^ that should do the trick.

    My problem with the new Twitter embeds in WP 3.4 is that they have a set width, which conflicts with the dimensions of the content area on my site. So, all embedded tweets get cut off by 20 pixels or so.

    Anyone else come across this?

  4. I've just pasted the two URLs you've put there into my test install. Both works fine for me. I did have to paste them in via the HTML editor because Windows included all the HTML. But it worked.

    I'm on 3.4 and I don't have any plugins and I'm using the Twenty Eleven theme.

    Try wrapping them in [embed] like so, see if that helps.

    Posted 4 years ago #

    @Jan: any idea on the width issue?

  6. Many! Or so I think. ;)

    Is there a link that can be shared so I can see by example the width problem?

    Posted 4 years ago #

    Posted 4 years ago #

    Looks like the width is set to 550px inline on the tweet wrapper (id=twitter-widget-0 and class=twitter-tweet-rendered).

  9. Yep, and after looking I found where it can be filtered too. Otto wrote about it in a comment.


    This works.


    function twitter_no_width($html, $url, $args) {
            if (false !== strpos($url, 'twitter.com')) {
                    $html = str_replace('width="550"','width="200"',$html);
            return $html;

    Add this to your theme's functions.php file (make a backup copy first) and play with that width="200" value.

    The oembed_result happens once, so edit and save your post to update the oembed cache if you make changes to the width.

    Edit: Your .hentry-middle is 460px, so try around that value to make it fit.

    Posted 4 years ago #

    Awesome! Worked like a charm.

    Thanks for the help, Jan.

  11. justted
    Posted 4 years ago #

    Thanks for all the help - I am finding though that sometimes the embeds work, sometimes they don't.

    Putting an [embed] tag in front just turns the text into a hyperlink.

    Is anyone else having this problem?

    I've turned off all plugins and gone to the stock theme and it's still happening - some posts the embed takes some it doesn't. Is this a Twitter api problem?

  12. I think it's actually your browser. I never have the problem on Chrome, I always have it on Safari.

  13. justted
    Posted 4 years ago #

    I just tried it with Chrome, and the problem persists.

    I can actually come back after a few hours, put up a post with a twitter link, that does embed correctly, and then try again a few hours later and it does not, with no changes to the blog settings.

    Pasting the embed code from twitter.com works fine, so I can use that in the meantime.

    Any other ideas as to what's going on?

    I'm on Dreamhost with Cloudflare by the way. I put things in developer mode to turn off caching to see if that made a difference, it didn't.

  14. padraigbeirne
    Posted 4 years ago #

    Hi justted,

    Had the exact same problem and this resolved it for me...

    On your admin dashboard go to Settings > Media

    Under the 'Embeds' title make sure Auto-Embeds is ticked. Pasting twitter urls should now work just like pasting youtube, vimeo and flickr urls. More info here - http://codex.wordpress.org/Embeds

    Hope this works for you! :-)

  15. sanerdesign
    Posted 4 years ago #

    If anyone is interested in a responsive option for twitter embeds until they come up with an answer I came up with an option here http://sanerdesign.com/2012/07/twitter-embed-width-issue-wordpress-fix/

    It's just a small bit of js that waits 100ms and then removes the inline style that Twitter adds

    Hope it helps someone

  16. cspowers
    Posted 4 years ago #

    For what it's worth. I was having the same problem. No matter what I did, pasting a tweet into a new post would not get formatted. Out of desperation I went in to Settings -> Media. The auto embed box was checked.

    But I unchecked the box, saved my settings, checked the box again, saved my settings again. And it has worked for me ever since.


  17. cspowers
    Posted 4 years ago #

    the other thing I have noticed is that if the link is wrapped with anything at all, the embed code will not be generated.

    For example, I pasted a twitter link into a new post and published it. Displayed just fine. Then I edited the post again and right aligned the link because I wanted to put it on the right side like an image and wrap text around it so it would appear like a callout. Didn't work. Just the link just displayed as left aligned text paragraph.

    Given that you can't control the alignment, wrapping or size with the default embed function, I'm going to use the twitter generated html code instead to give me better control over the formatting

  18. Shyzer
    Posted 4 years ago #

    cspowers, just wanted to jump in here and say thanks. Ticking that box fixed my problem as well.

  19. Paul Cole
    Posted 4 years ago #

    Hi all

    I also had this issue when working on a really long post full of embedded tweets to demonstrate live twitter coverage of a meeting (not yet published).

    Anyway, I got the occasional issue with the embedded tweets vanishing and just the URL remaining. I kept restoring previous versions and got really frustrated.

    It all seemed to happen (as cspowers noted) when the formatting altered: either when I did something or when inserting an images changed the alignment without me wanting it to.

    I had almost finished the post last night and the issue had completely beaten me. I'd checked, unchecked and rechecked the box to enable embedding, restored almost every previous version and even copy and pasted the entire post into a new post.

    Nothing. Fail.

    Woke up this morning with new energy and tried pasting the entire post into a new post as plain text. YES! It worked, although I'd have to go through the entire thing and correct all the paragraph spacing, which may cause me problems again.

    So, I tried simply cutting and pasting the first tweet back into the post as plain text, just to see if it would work and I could then do the rest of the tweets.

    Bingo! When I previewed it, all the embedded tweets had been restored!

    I've saved it and left it alone for now. It's a great feature, but I think there are still some bugs to iron out.

    Hopefully this will continue to work for me and may work for some of you.


  20. NewYorkerAtHeart
    Posted 3 years ago #

    So nice to see I wasn't the only one struggling with this. I was able to get it to work using @cspowers media settings tip. But then it happened again, so I switched from safari to google chrome and tried the media settings tip and it worked. So perhaps you need to jump back and forth??? But then I tried viewing the embedded tweets on my iPhone and they didn't even come close to fitting properly (as they did on the blog post) and they didn't embed all the links either. Yuck! I'm going to just manually put in the tweets and style them for now.....unless twitter/wordpress.org fixes this!

  21. notpoppy
    Posted 3 years ago #

    I'm having the same problem as Paul Cole @paul-cole but the solution he suggested isn't working for me:

    If anyone can help, please let me know here:


  22. Vedran
    Posted 3 years ago #

    In my case there were two identical posts, both with just direct twitter links (albeit different). One post worked, the other one didn't.

    I got the other one to work by simply switching to the Visual editor and then back to HTML. Right after saving everything started working just fine.

  23. notpoppy
    Posted 3 years ago #

    Thanks Vedran, unfortunately I just tried this a few times and it made absolutely no difference for me.

  24. mhk1058
    Posted 3 years ago #

    Resorted to Twitter embed code, the link/page format option can change from an embedded tweet to a link before your eyes with nothing more than a page refresh... very odd.

  25. notpoppy
    Posted 3 years ago #

    Yep that sounds exactly the same as my problem, and using the manual Twitter embed code is the best workaround I've found so far.

  26. Victor
    Posted 3 years ago #

    I have the same issue, my embed tweet shows plain text. did anyone come out with a solution?

  27. jeremyers1
    Posted 3 years ago #

    I have the same problem... and not only that, but there is no box in Media Settings for "Auto Embeds." Did it get removed in a recent version of WP?

Topic Closed

This topic has been closed to new replies.

About this Topic