11 Tips for Optimizing Your WordPress RSS Feed
If there were something you could do reasonably quickly and easily to improve the speed and overall user experience of your website, chances are you’d do it: there are no downsides. Well, we’re about to show you how to improve one functionality of your website: your RSS feeds.
While they do cater to a minority of users, RSS feeds are a default feature of WordPress, so a bit of adjustment is all you need to do to show your RSS-using visitors you care about them. In this article, we will be talking about optimizing WordPress RSS feed for your website. But what are RSS feeds? What is their purpose? Before we get into the gory details, we would like to address the basics.
Here’s what we’ll be talking about:
RSS stands for Really Simply Syndication, and it is in essence a form of content delivery. Technically speaking, you do have to have a special piece of software called a news aggregator to access the feed, but most of them are very simple. The user subscribes to as many or as few websites they want, and all of their updates are aggregated and displayed in their readers.
To generate an RSS feed, you need an XML file. XML files are structured post data which the RSS feed readers use to present your content to their users. You don’t need to do anything to create an XML file for your website – WordPress does it all automatically. You can find it by appending /feed to your URL. For instance, the URL for the XML file for Qode Magazine is this:
https://qodeinteractive.com/magazine/feed/
The users simply paste the link into their reader and the reader automatically checks for updates.
As for why you should be optimizing WordPress RSS feed, there are a few good reasons. Other than those we’ve already talked about (speed and UX), you also get better protection against content scraping, improve your online reputation, rank better on SERPs, and get more traffic coming into your website. There are no downsides, but it takes a little time and effort.
It may be that your RSS feed is showing the entire article, eliminating the need for people interested in your content to visit your website at all. Setting your RSS feed to show a summary fixes this problem.
To do that, navigate to Settings/Reading on your WordPress website.
Find the For each post in a feed, include radio button, and set it to show an Excerpt. Click the Save Changes button.
Now, news aggregate users will need to visit your website if they want to read the entire text of each article which interests them.
With before and after the feed text, you get a chance to add a blurb to your articles. The more information a reader has, the more likely they are to know whether they are interested in your content. Your SEO plugin likely contains the requisite functionality. Our preferred SEO plugin is Rank Math, and we will be using it in this demonstration.
After installing and activating the plugin, you will need to configure it to make full use of it, but that is beyond the scope of this article. To set up the before and after feed texts, navigate to Rank Math/General Settings from your WordPress dashboard.
Once there, click the Others tab.
Here, you can edit the RSS Before Content And RSS After Content text and add the variables outlined in the table. Once you are happy with everything, click the Save Changes button.
Featured images are not added by default to your RSS feed. You can include them in your RSS feeds even if they don’t appear in the main body of the article by adding some custom code to your WordPress website. The code you need to add to your .functions.php file is this:
function rss_featured_image($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<div>' . get_the_post_thumbnail($post->ID) . '</div>' . get_the_content(); } return $content; } add_filter('the_excerpt_rss', 'rss_featured_image'); add_filter('the_content_feed', 'rss_featured_image');
Note that changing your functions.php file can be risky, and you should always use a child theme or snippet plugin.
You can supplement the post titles of your RSS feeds with the category they belong to if you wish to make it clearer to your visitors what the post is about. To add a category name to the post title, you need to add this code to your functions.php file, as described above:
function rss_title_category($content) { $post_category = ""; foreach((get_the_category()) as $cat) { $post_category .= ' ('.$cat->cat_name . ')'; } $content = $content.$post_category; return $content; } add_filter('the_title_rss', 'rss_title_category');
This code will display all the categories a post belongs to in parentheses next to the title. For instance, if you are running a food blog, a recipe post title might look something like this:
Boeuf Bourgignon (Mains)(Meat Dishes)(French)
If you want to provide more information to your RSS feed followers, you can add more text to an item which contains a certain tag or category.
Suppose, for instance, you are running a news website and there is an election ongoing. If you add the following code to your functions.php file:
function rss_taxonomies($content) { if( is_feed() ){ if ( has_term( array( 'politics', 'elections_2021' ), 'post_tag' ) ) { $content = $content."<br /><br />Read the latest on the 2021 election!"; } } return $content; } add_filter('the_excerpt_rss', 'rss_taxonomies'); add_filter('the_content', 'rss_taxonomies');
any post with the politics or elections_2021 tag will also display the message “Read the latest on the 2021 election,” thus informing your readers that the post pertains to the ongoing political process. This should go without saying, but the code will do nothing if the tags mentioned do not exist.
If you are using this method for categories, simply replace post_tag with category in the code above. Also make sure to replace the relevant tags (or categories) in line 3 of the code as well as the message in line 4 with your own.
Not all your website visitors will be interested in all your website content. This is where organizing your content into taxonomies comes into play. You can find a category feed on your website the same way you would find the website’s general RSS feed: by adding /feed to a category URL. This, for example, is the RSS feed link for the “Design” category of Qode Magazine:
https://qodeinteractive.com/magazine/category/design/feed
There are also easy solutions to facilitating subscriptions to category-based RSS feeds, and you can even create custom RSS feeds, if you so choose.
Content scraping is a technique used by bad actors to basically steal your content and present it as their own. Not only is somebody using your content without putting in any of the work you did or paying you any money for it, scraped content also competes with your own content for visits. Scraping also generates false page views and can slow down your website.
There are many techniques you can use to protect your website from content scraping: so many they merit an article for themselves.
Delaying posts from appearing in your RSS feed will give search engines time to index your content, making sure yours is the original version. This deters content scrapers by preventing your posts from appearing plagiarized in case you wish to make a quick edit (for typos, say) immediately after publishing a post.
To delay posts from the RSS feed, add the following code to your website:
function publish_later_on_feed($where) { global $wpdb; if ( is_feed() ) { $time = gmdate('Y-m-d H:i:s'); $delay = '15'; $interval = 'MINUTE'; $where .= " AND TIMESTAMPDIFF($interval, $wpdb->posts.post_date_gmt, '$time') > $delay "; } return $where; } add_filter('posts_where', 'publish_later_on_feed');
The above code will delay a post from appearing in your RSS feed for 15 minutes. You can change it by replacing 15 with an integer number of minutes in the line:
$wait = '15'
While they have been around for decades, RSS feeds have slightly fallen out of fashion. And, thanks to so many instant messaging apps, so has e-mail. But just as sure as TV did not kill the radio star, e-mail is still out there and has a purpose. Now, while many people use RSS news aggregators, many don’t, but you’d be hard pressed to find a person who doesn’t use e-mail. We have talked about starting up an e-mail newsletter using Mailchimp, but you can also use it to create an e-mail RSS feed.
Like them or not, social networks are how many people find new content and people spend a lot of time curating their social profiles. Adding social buttons to your RSS feed will make this easier for them, and can only result in a wider social reach for your website.
To do that, you need to add the following code to your website:
function social_add($content) { if(is_feed()) { $encoded_permalink = urlencode(get_permalink()); $title = get_the_title(); $content .= '<p> <a href="http://www.facebook.com/sharer/sharer.php?u=' . $encoded_permalink . '" title="Share this on Facebook"><img src="ICON URL" title="Share this on Facebook" alt="Share this on Facebook" width="64px" height="64px" /></a> <a href="http://www.twitter.com/share?&text='. $title . '&url=' . $encoded_permalink . '" title="Share this on Twitter"><img src="ICON URL" title="Share this on Twitter" alt="Share this on Twitter" width="64px" height="64px" /></a> </p>'; } return $content; } add_filter('the_excerpt_rss', 'social_add'); add_filter('the_content', 'social_add');
Be sure to replace the ICON URL placeholders with proper icon file URLs.
This one should go without saying, but we will iterate it: always test for and fix any RSS feed errors. A buggy website is a UX nightmare, and you should always take care to fix any errors which may arise. The same goes for RSS feeds, as they are a default function of your WordPress website.
In Conclusion
As you can see, there is a lot of ways to improve the experience of your RSS feed subscribers. Some of them are easy to implement, while some of them might take a little effort to set up, but there is an important commonality to all of them: each and every one of them is useful. If you happen to know that a lot of your website visitors are RSS feed users, optimizing your RSS feed should be a priority. If they are a small minority, you can still do a lot for them and for yourself with just a little effort and no money at all.