Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Completely Customize Your WordPress RSS Feeds (Easy)

Do you want to add content to your WordPress RSS feeds?

By default, WordPress RSS feeds show your recent post content and there is no option to customize that content for your RSS feed users.

In this article, we’ll show you how to easily add content and completely manipulate your WordPress RSS feeds.

Adding custom content to your WordPress RSS feeds

Add Custom Content to WordPress RSS Feeds (Easy way)

The easiest way to add custom content to your WordPress RSS feeds is by using the All in One SEO for WordPress plugin. It is the best WordPress SEO plugin on the market and allows you to easily optimize your website SEO.

First thing you need to do is install and activate the All in One SEO for WordPress plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you will be prompted to set up the plugin. Simply follow the on-screen instructions or check out our guide on how to set up All in One SEO for WordPress.

After that, you need to visit All in One SEO » General Settings page and switch to the RSS Content tab.

Adding custom content to your WordPress RSS feed using All in One SEO

From here you can add content that you want to display before and after each RSS feed item. You can use smart tags to add links and other metadata to the custom content.

Adding before and after content for each post in your RSS feed

You can also use basic HTML to format your custom content any way you like.

Once you are satisfied with the changes, don’t forget to click on the Save Changes button.

All in One SEO will now add your custom content to each RSS feed item.

Adding Content to WordPress RSS Feed using Code

The first method mentioned above is the easiest way to add custom content to your WordPress RSS feeds. However, it adds the content to all items in your WordPress feed.

What if you wanted to add content to specific posts, posts in select categories, or display custom metadata into your RSS feed?

These next few steps will help you flexibly add content to your RSS feed using custom code snippets.

You can add these code snippets to your website using the custom Code Snippets plugin, via functions.php file, or a site-specific WordPress plugin.

Let’s try some examples of adding custom content in WordPress RSS feeds manually.

1. Add Data from a Custom Field to Your WordPress RSS Feed

Custom fields allow you to add extra metadata to your WordPress posts and pages. However, this metadata is not included in RSS feeds by default.

Adding custom fields in WordPress

Here is a snippet you can use to retrieve and display custom field data in your WordPress RSS feed.

function wpb_rsstutorial_customfield($content) {
global $wp_query;
$postid = $wp_query->post->ID;
$custom_metadata = get_post_meta($postid, 'my_custom_field', true);
if(is_feed()) {
if($custom_metadata !== '') {
// Display custom field data below content
$content = $content."<br /><br /><div>".$custom_metadata."</div>
";
}
else {
$content = $content;
}
}
return $content;
}
add_filter('the_excerpt_rss', 'wpb_rsstutorial_customfield');
add_filter('the_content', 'wpb_rsstutorial_customfield');

This code first checks if the custom field has data inside and the RSS feed is displayed. After that, it simply appends the content global variable and adds custom field data below the content.

2. Adding Additional Text to Post Titles in RSS

Do you want to display additional text to the title of some posts in your RSS feed? Perhaps you want to distinguish between regular articles and guest or sponsored posts.

Here is how you can add custom content to post titles in your RSS feed.

Example 1: Adding Data from Custom Fields to RSS Feed Post Title

First, you would want to save the content you want to display as a custom field. For instance, you can add guest_post or sponsored_post custom fields.

After that, you can add the following code to your website.

function wpb_rsstutorial_addtitle($content) {
global $wp_query;
$postid = $wp_query->post->ID;
$gpost = get_post_meta($postid, 'guest_post', true);
$spost = get_post_meta($postid, 'sponsored_post', true);
 
if($gpost !== '') {
$content = 'Guest Post: '.$content;
}
elseif ($spost !== ''){
$content = 'Sponsored Post: '.$content;
}
else {
$content = $content;
}
return $content;
}
add_filter('the_title_rss', 'wpb_rsstutorial_addtitle');

This code simply looks for the custom fields. If they are not empty, then it appends the value of the custom field to the post title in your RSS feed.

Example 2: Adding Category Name to Post Title in RSS Feed

For this example, we will display the category name in the post title.

Simply add the following code to your website:

function wpb_rsstutorial_titlecat($content) {
$postcat = "";
foreach((get_the_category()) as $cat) {
$postcat .= ' ('.$cat->cat_name . ')';
}
$content = $content.$postcat;
return $content;
}
add_filter('the_title_rss', 'wpb_rsstutorial_titlecat');

Now, it will show categories along with post titles in the RSS feed. For example, “Top New Restaurants in Bay Area (News) (Travel)” where News and Travel are categories.

3. Add Custom Content to Posts with Specific Tags or Categories

Now let’s suppose you want to add custom content but only for posts filed under specific tags or categories.

The following code will help you easily add content to posts filed under specific categories and tags.

function wpb_rsstutorial_taxonomies($content) {

if( is_feed() ){

// Check for posts filed under these categories
if ( has_term( array( 'travel', 'news' ), 'category' ) ) {

$content = $content."<br /><br />For special offers please visit our website"; 

}
}
return $content;
}
add_filter('the_excerpt_rss', 'wpb_rsstutorial_taxonomies');
add_filter('the_content', 'wpb_rsstutorial_taxonomies');

You can modify this code to target tags as well as any custom taxonomies. Here is an example of targeting specific tags:

function wpb_rsstutorial_taxonomies($content) {

if( is_feed() ){

// Check for posts filed under these categories
if ( has_term( array( 'holidays', 'blackfriday' ), 'post_tag' ) ) {

$content = $content."<br /><br />For special offers please visit our website"; 

}
}
return $content;
}
add_filter('the_excerpt_rss', 'wpb_rsstutorial_taxonomies');
add_filter('the_content', 'wpb_rsstutorial_taxonomies');

4. Add Featured Image to RSS Feed

By default, your WordPress RSS feed does not show featured images for posts. You can change that by manually adding featured images to your RSS feed.

function wpb_rsstutorial_featuredimage($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) .
'</p>' . get_the_content();
}
return $content;
}
add_filter('the_excerpt_rss', 'wpb_rsstutorial_featuredimage');
add_filter('the_content_feed', 'wpb_rsstutorial_featuredimage');

This code simply checks if a post has a thumbnail (featured image) and displays it along with the rest of your post content

Bonus Resources on Customizing WordPress RSS Feeds

RSS feeds can be a helpful tool in bringing more users and keeping your existing subscribers engaged. Following are a few resources that will help you further optimize your WordPress feeds.

We hope this article helped you learn how to add content to your WordPress RSS feeds. You may also want to see our articles on how to add email subscriptions to your WordPress blog and get more free traffic to your website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

36 CommentsLeave a Reply

    • We do not recommend adding content after every paragraph in your RSS feed at this time.

      Admin

  1. On your RSS feed you’ve got a real simple “To leave a comment please visit [Post Title] on WPBeginner.”

    How do I replicate this? In your code that you’ve supplied, presumably I have to change “coolcustom”, but which one do I edit specifically?

  2. Hi.
    If I have in post:
    [text1]Text one[text1]
    [text2]Text two[text2]

    How do I return text2 shortcode in rss only?

  3. I’m trying to use the third option to add the Digg Digg plugin’s buttons to the bottom of my RSS feeds. Any suggestions on editing the content to incorporate PHP rather than just text?

  4. I am trying to use this to implement CSS disclosure buttons in my feed, but I *cannot* figure out how to get it into the description. I have code of what I tried (2 different functions for the excerpt & the post). i hate how the buttons show up in the excerpt and i don’t think it’s necessary. help? :)

  5. I really appreciate you sharing this information with us. I have implemented this on my site now…I always really liked how it looks in your “weekly” emails that I receive.

    I think that it looks very professional and of course it is gonna help fight back against those content scrapers (thieves).

    Again, well written code, and very useful advice. Thank you!

  6. Great info! One question…  on #1 Add a Custom Field to your WordPress RSS Footer, for some reason the content/custom field is displayed twice. Any idea why?

  7. I have problem that in my site if someone fills a contact us form then his all personal info is displayed in rss feed and any user can see it
    plz help !!!!!
     

  8. I actually got it now. Just edited the “$content = $content.”<br /><br /><div>”.$coolcustom.”</div>n”;” line. Perfect!

  9. Adding the additional text works great but I’m trying to have the RSS to show only that custom field (for example the “coolcustom”) as the post’s description. Get rid of the actual text of the post. Is that possible?

  10. Hi, I’m looking to add two fields to my ‘full’ rss feed. One which displays the author of the post and the other which displays a list of the taxomonies, if any, that the post is in. So let’s say the author is JohnR and the post is in the NFL, Raiders and Jets taxonomies, the RSS would have two additional fields:

    JohnR
    NFL, Raiders, Jets

    Can someone point me in the right direction to get this done?

    – Scot

  11. Thanks for sharing…

    Your tutorial is useful to me for verify the Technorati claim token! It worked nicely. I was looking for an effective way to verify it and found articles that discuss about that. But most of it, is not effective. And in the end, thought in my mind how add extra text in each footer post RSS feeds, Great! I found a smart way through your article, Thanks!!

  12. Hi,
    your code to add Custom Fields to RSS works great!!!! Thanks!
    I’m wondering if there is a way to edit the position and not to show the custom fields in the footer but above the title, or under the title, or etc… Is there a chance to add the tag “style” and so use some css?
    Thank you very much

  13. Add a Custom Field to your WordPress RSS Footer:
    THANKS Your code works perfectly. I have a question: How can I edit the position to show custom field up before the title or just after the title?
    I tried to edit the code here:
    $content = $content.””.$coolcustom.”
    “;
    I can remove the br tags and it works but where can I add style and css?

    Thanks for your great help

    • You would have to use inline styling for the RSS to work on all different readers. To add it before, you will add it like $coolcustom.$content and then add div tags using quotation where you like…

      Admin

  14. Hi,

    I’m trying to find a way to use a custom field to EXCLUDE a post from the RSS feed.

    Any ideas?

    Cheers,
    Robert

  15. Hey, thanks for the tutorial. It worked perfectly. Had a quick question though – after I get the extra content to load into the RSS Feed (for example if I’m viewing it in Safari), when I actually embed the RSS Feed on a website, that extra info goes away. Do you have any idea why that would happen? It’s been about 4 days as well – and I’ve tried clearing my cache several times. Thanks!

  16. Thanks for this so far! I haven’t been able to find much on adding custom fields to the RSS feed until now.

    Would it be difficult to add multiple custom fields with the code from section 1? I have an event listing website with custom fields for each post I want to display in the RSS, i.e. “Venue,” “Event Date,” “Address,” et al.

      • Sorry, I’m a bit of a novice, but what would the code look like to get the multiple custom fields. I’ve tried playing with a few configurations of the code so far but it keeps resulting in errors. One field is working great though!

    • Ajay but does your plugin allows one to add custom fields in the RSS Text? Because it just seems like that it has the exact same functionality that Joost’s RSS Footer Plugin has which is not what this article is showing. What if you need to display different FTC texts for each post, then plugins like yours and RSS Footer would fail because they show the same text on each post. With this, one can set different ways: For example, if custom field this: Display that otherwise display the default copyright or something like that.

      Admin

  17. This is great, it should help out a lot when trying to do quick little customizations. Little bite-sized tips like this are very helpful. I’ve seen people put some of the social media icons at the bottom too, to add to digg, and su and stuff.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.