Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Embed an External RSS Feed in WordPress Posts via Shortcode

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Embed an External RSS Feed in WordPress Posts via Shortcode

Have you ever seen showcases like 25 best XYZ sites to follow? Usually these tutorials have the site name, site screenshot, a small description, and the list of recent posts. The main issue with those posts are the list of recent posts which gets outdated overtime because most authors manually create those links at the time of writing. That post is really outdated as soon as any one of those other sites publish a new post. Well in this article, we will show you how to embed an external RSS feed in WordPress posts via shortcode, so you can keep your list posts relevant.

First thing you need to do is open your theme’s functions.php file and paste the following code:

//This file is needed to be able to use the wp_rss() function.

function readRss($atts) {
	"feed" => 'http://',
      "num" => '1',
    ), $atts));

    return wp_rss($feed, $num);

add_shortcode('rss', 'readRss');

Now all you have to do is use this shortcode when writing a post:

[rss feed="" num="5"]

Make sure you change the feed URL in the shortcode to what you want. You can also adjust the number to your liking.

Source: Smashing Magazine

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. jillian says:

    HI I was able to get the feed to successfully work. My only problem is i am going to be adding many feeds from different websites. In doing so, i need to add the website logo above each feed. No matter what i do in the code the feeds readjust to the top :

    please help, thanks!

  2. MerryLeigh Giarra says:

    How would you add target _blank or make the link open in a new window?

  3. Albert Israel says:

    I get it working now. Thanks for this article :)

  4. murkee says:

    Very interesting, but did you know wp_rss is deprecated, and they recommend the use of fetch_feed instead?

    What I often think is needed with custom shortcodes is a bit of code which tells WP to behave gracefully with unrecognised shortcodes (especially useful when themes change).

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.