How to Easily Embed a Twitter (X) Feed in WordPress Without Plugin

Header image for the post, displaying the post title with the background being a screenshot of an embedded Twitter feed on this website

As a web developer, using social media plugins which are famously prone to breaking are the bane of my existence.

That’s why, when I figured out that you could very easily embed a Twitter (X) feed of your timeline directly on your WordPress website without using any plugins, I knew I had to write about it immediately.

This incredibly lightweight solution will only load on the page it’s embedded on, is naturally responsive, and requires virtually no configuration.

Sound too good to be true? It’s not!

The team at Twitter actually did a great job here. They are the ones that built it!

Steps to embed a Twitter feed on your website without a plugin:

  1. Go to Twitter’s “Publish” page: https://publish.twitter.com/
    Screenshot of the Twitter Publish page
  2. Enter the URL of the feed you wish to use (note that you can do your own twitter feed, or even link to a specific tweet) and click the arrow.
    The Twitter Publish page with a URL entered
  3. Choose a display option. For a traditional “timeline”, obviously select “Embedded Timeline”.
    Screenshot of the display options in Twitter Publish
  4. Click “Copy Code” to get your embed code, or “set customization options” if you’d like to customize it a bit. I find it’s pretty good right out of the box!
    Screenshot of the generated code and "copy code" button from Twitter PublishIf you’d like to customize the options a bit, the available options are:
    – Height (in pixels)
    – Width (in pixels – leave this blank and it will automatically adapt to where it is)
    – Color scheme (light or dark)
    – Language
    Screenshot of the customization settings available for Twitter Publish
  5. Copy the code to your website using the text editor (not visual editor) wherever you’d like it to display, and then publish your changes.
    Screenshot of the Twitter feed embed code being added directly to the text editor in WordPress

Voila! Your feed is displayed.

Screenshot of an embedded Twitter feed displaying on a website without using a plugin

This method to embed your Twitter feed or even individual tweets works extremely well, and has tons of advantages over using a plugin:

  • It’s extremely easy to set up, unlike plugins
  • It’s very lightweight and won’t slow your site down
  • It unlikely to break, like the plugins always seem to do
  • It adapts to any screen size or to the size of the container it is in

I love it!

It’s worth noting that Facebook has a similar tool, but it doesn’t work nearly as well because, inexplicably, it isn’t responsive and has a bewildering maximum width of 500px. Suitable for a sidebar, perhaps, but that’s it.

So in conclusion: don’t ever use any social media plugins. They are terrible, will break, slow down your site, and are in all ways inferior to this extremely easy method.

About Brian Johnson

Brian Johnson is a website developer and designer living in Minneapolis, Minnesota with a passion for code and WordPress. He spends his days building WordPress websites for small businesses, developing new code with the online community, and living life.

Leave a Reply

Your email address will not be published. Required fields are marked *