How to show a featured image in a WordPress RSS feed
We recently had the need to show a featured image in a WordPress RSS Feed. It got me thinking that it may surprise many people how often XML feeds are still used in modern day web development. Whilst I will say that API’s have replaced an awful lot of the “XML Feed” usage cases, we’ve still used them over the last few years to aggregate data, and pull in jobs from CRM solutions or properties from property management systems.
Our most recent usage case was the need to expand the default WordPress posts to include the featured image. We had a quick look online but ultimately ended up creating something ourselves. Our post below will explains what an RSS/XML feed is, demonstrates how to show a featured image in a WordPress RSS feed and we show how you could utilise this feature with YouTube.
- What is an RSS feed and XML file?
- How to show a featured image in your WordPress RSS Feed
- Did you know you YouTube supports RSS feeds?
- How to set up RSS feed on WordPress
- Do RSS feeds fall under copyright laws?
1) What is an RSS feed and XML file?
An RSS (Really Simple Syndication) feed is a web feed that allows users and applications to access updates to online content in a standardised, computer-readable format. An XML (Extensible Markup Language) file, on the other hand, is a markup language that is used to store and transport data. While RSS feeds are often delivered in XML format, XML files can contain a wide variety of data, not just RSS feeds.
Despite their differences, RSS feeds and XML files share some similarities. Both are used to distribute data over the internet, and both can be read and processed by software applications. Additionally, both RSS feeds and XML files can be used to provide structured information, making them useful for organizing and sharing data.
In the next sections, we will explore how to create an RSS feed XML file for your YouTube channel, and answer some common questions about RSS feeds and XML files.
2) How to show a featured image in a WordPress RSS feed
Option 1: Include within the description
The first option I came across was to include the featured image within your description, whilst this may be beneficial for those of you who want to add your content to news feeds or aggregator services such as feedly.com then this might be the snippet you’re looking for.
Option 2: Include as a separate field
After 5-10 minutes on forums I couldn’t find a suitable solution for how to show a featured image in a WordPress RSS Feed so I resided to creating something myself. The below code will add the featured image into a separate field and will pop up in the field looking something like the below
Option 3: WordPress Plugin Repository
You’ll rarely (if ever) see a recommendation of repository plugins in our posts. They’re not something we utilise a lot of as we’re bigger advocates of using premium solutions or creating something ourselves. But as long as you don’t go “plugin crazy” then the WP repository does have it’s place in the world. So if it’s not something we have used extensively we won’t make a recommendation but have a little browse through if you’re not familiar or comfortable adding custom code to your WP install.
3) Did you know you YouTube supports RSS feeds?
Tapping into your own feed can be done via the YouTube API or via RSS but if you wanted to create a fan website, pull in YouTube videos from selected creators or even from a playlist you created, well then XML might be one of the better options as your disposal.
How can I create a YouTube RSS feed?
Many years ago it was as simple as adding /rss to the end of the channel ID BUT this feature has been removed likely in favour of YouTube own subscriptions or API.
- WordPress = https://www.youtube.com/wordpress/
- Channel ID = UCpJf6LGZ0a4n9Lj4aVt9spg
Here is the “tricky” bit and a taster of code
- Step 1: Go to the YouTube Channel of your choice (we’ll be using https://www.youtube.com/wordpress)
- Step 2: right click any part of the screen and choose (inspect, view source code or similar) – you should be able to see lots of code (don’t worry, you don’t need to understand it)
- Step 3: press “ctrl + f” to open up the “search” feature on any browser and type “browse_id” you will be presented with a long ID, something like this: UCpJf6LGZ0a4n9Lj4aVt9spg
Using the ID from above you can create the YouTube feed – https://www.youtube.com/feeds/videos.xml?channel_id=[INSERT THE ID FROM ABOVE]
- WordPress Channel Feed = https://www.youtube.com/feeds/videos.xml?channel_id=UCpJf6LGZ0a4n9Lj4aVt9spg
How can I create a YouTube Playlist RSS feed?
The process is similar to the above BUT without the need to view the source code, as YouTube add the playlist ID in the browser for you so it’s even easier:
- Go to the playlist of your choice and you’ll see the URL ends with something like “list=PL1pJFUVKQ7ESY-3rCwwYSAdNsEj2W7cJi”
- Take https://www.youtube.com/feeds/videos.xml?playlist_id=PL1pJFUVKQ7ESY-3rCwwYSAdNsEj2W7cJi
4) How to set up RSS feed on WordPress
Now you know how to show a featured image in a WordPress RSS feed but do you know all the various types of RSS feeds WordPress generates by default? Here are some of the most common types of RSS feeds that you can retrieve from WordPress:
- Post Feed – A feed that includes the latest posts from your blog.
- Category Feed – A feed that includes the latest posts from a specific category on your blog.
- Tag Feed – A feed that includes the latest posts that are tagged with a specific tag on your blog.
- Comment Feed – A feed that includes the latest comments on your blog.
- Author Feed – A feed that includes the latest posts from a specific author on your blog.
- Custom Post Type Feed – A feed that includes the latest posts from a custom post type on your blog.
To retrieve these feeds, you can add “/feed” at the end of the respective URLs of the feed types. For example, to retrieve the post feed, you can add “/feed” at the end of the URL of your blog’s homepage.
5) Do RSS feeds fall under copyright laws?
Generally, RSS feeds are not subject to copyright protection since they are considered factual information instead of creative expressions. Nevertheless, any material embedded in an RSS feed, like videos or blog articles, may be covered by copyright, and it is essential to acknowledge the intellectual property rights of the content creators while using RSS feeds.
If you need help with feeds of any type, whether you want to send your data to an external source or receive external feeds onto your site (i.e. YouTube, Jobs Property etc) then you can drop us a quick message or book a free consultation with a member of the team.
Something in the article peaked your interest? We’re never more than a contact form or a quick call away so please don’t hesitate to get in touch!