How to get Tweets from your Twitter account in WordPress using Fetch Tweets

    Ankita Kawde
Listen to this article

Twitter, one of the inescapable additions to the social media, has grown exponentially. With each tweet of just 140 characters or less, there is so much of information being traded and discussed out there, from which the readers can benefit! People also use Twitter as a quick and easy way to get information out without having to write long e-mails or make telephone calls to everyone they know.

Embedding tweets into articles on your WordPress site is a great way to ensure that readers don’t have to head out to an external site to get that information. This is where, the ‘Fetch Tweets’ plugin helps you curate a collection of public tweets into the WordPress sites without having to opt for complex JavaScript Twitter APIs!

You need to first install the plugin.


Authorizing the Plugin

In general, to embed tweets into your website, you need to authenticate your Twitter account to fetch tweets from any account. This could be complex as authentication requires you to first create a developer application and then generate API keys which are further configured in your WordPress website. Unfortunately, Twitter pushes you to do such application-level authentication even for simple public timeline ‘GET’ requests.

The Fetch Tweets plugin gives you a nice and simple way out of all such complexities. You just need to click on the Connect button in the Authentication page of the plugin and it will redirect you to the Twitter’s authentication page. Then you log in to your Twitter account there and authorize the plugin. That’s it!

Getting Started

#1 The Add Rule by User Name page:

You can add your own tweets, your followers tweets and also tweets of people whom you are following , all on your WordPress site. The ‘Add Rule by User Name’ page allows you to do this. Go to Dashboard> Fetch Tweets> Add Rule by User Name.

  • You can configure the tweets of as many people as you want here, provided either you follow them or they follow you.
    Start with configuring your own Twitter account first.
Add twitter feeds by Username
Add Twitter feeds by Username
  • You first need to set the rule name. We have set our rule name as #WisdmLabs.
  • The user name field should contain a username similar to the username of your Twitter account.
  • You can set rest of the fields according to your requirements.
  • Click on Publish.

You can add as many ‘Add Rule by User Name’ entries as you want. All you need to do is have a new page for each of them, set the rule name, Twitter username and publish.

Once you click on publish, all of these entries (rules) which you add will be stored in the Manage Rules page of the plugin along with their respective shortcodes and PHP codes. All you need to do is add these codes on a page to display the tweets.

We shall talk about displaying tweets in the later part of this article.

#2. The Add Rule by Search page:

Want to bring together searches on keywords like “WordPress” and “Plugin”? It’s easy, all you need to do is make separate rules for each keyword. Okay, let’s make this simple- Go to ‘Add Rule by Search’ page.

Add tweets using a keyword
Add tweets using a keyword

First add the rule name, we have given ‘#WP’ as the rule name here. Enter the keyword to be searched. We have entered ‘wordpress’ as the search keyword here. Leave the other settings at default or customize it as per your requirement.

On publish, all of the search entries which you add will again be stored in the Manage Rules page of the plugin along with their respective shortcodes and PHP codes.

#3. Manage Rules:

Manage tweeting Rules
Manage tweeting Rules

The manage rules page displays all the entries of your ‘Add Rule by User Name’ and ‘Add Rule by Search’ pages along with their short code and other such details. The shortcode keeps a track of the tweets’ id.

Shortcode/PHP code for tweets
Shortcode/PHP code for tweets

In the screenshot, you can see that for #WisdmLabs entry the shortcode for fetching WisdmLabs tweets is (red arrow) [fetch_tweets id=”227”]

This shortcode helps you to display all the tweets in a specific page/post. All you need to do is go to Dashboard> Add new Page/post.

  • Enter the title for Page/Post. We have given the title as ‘Twitter Tweets’. And paste the shortcode generated above in the text area.
  • Click on publish.

Now when you visit your site’s page you’ll see a page titled ‘Twitter Tweets’.

When you click on it, it’ll display a list of all the tweets whose shortcode you add in the text area of the ‘Twitter Tweet’ page (or any other page) that you create.

How the tweets look on a Page
How the tweets look on a Page

Please Note:

You will see a php code along with the short code(blue arrow). In our case, the php code for #WisdmLabs is <?php fetchTweets( array( ‘id’ => 227 ) ); ?>

Shortcode/PHP code for tweets
Shortcode/PHP code for tweets

This is the PHP code for fetching tweets from the #WisdmLabs Twitter account. Using this code, you can modify your theme which lets you place the tweets anywhere in your website- sidebar, header, footer.

To do this you need to place the PHP code in the template file of your WordPress website’s theme file in the server. That’s it!

Additionally the ‘Fetch Tweets’ plugin also allows developers to write additional add-ons and templates. One of its extensions is the Feeder which supports RSS feeds so that you can subscribe to anybody’s tweets, which was much harder with the Twitter API as you needed authentication.

You will find the feeder extension in the Extensions page of the plugin.


Overall, Fetch Tweets is a very simple, easy to use plugin that lets you fetch tweets from your Twitter account without having to undergo all the hassles of complex API key generation. With this, not just the developers but anyone out there can easily share tweets on their WordPress sites! Happy Tweeting!

Our WordPress API Integration experts will help you have a smooth integration journey. Connect with us today to avoid any hassle.

Do leave your feedback and queries in the comments section below.

Ankita Kawde

Ankita Kawde

4 Responses

Leave a Reply

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

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads