RSS is one of the core feature of WordPress and every other blogging platform. It is very useful because your readers keep track of your blog updates mostly by using RSS. In this article, we will show you some of the most useful RSS hacks, tips, tricks, and snippets for WordPress.

1. RSS Only Posts

There are times when people cannot afford to have a newsletter service like Aweber, but they still want to reward their subscribers. They still want to keep an incentive for subscribers, so your count keeps growing. This trick will help you create posts that is only shown to your RSS readers.


You can achieve this by downloading the plugin called Advanced Category Excluder. Once installed, you should designate a specific category where you will post your RSS only posts. You can even name the category “RSS Only”. Then you need to go to the ACE Settings in your WP-Admin Panel and click on the feature Categories. Check in all boxes like Home, Archives for “RSS Only” Category, and leave the RSS Posts blank. This means that you have excluded RSS Only from being displayed in your home page, archives, and other places except for the RSS Feeds.

This is almost like a newsletter sent to just your RSS email subscribers and feed subscribers.

2. Control When Your Posts are Available Via RSS


There are times when you publish a post and suddenly find an error. You can go back in the admin panel and change it, but it is already published in the feeds. With this hack, you can put a delay of as many minutes as you like, so you can double check the post live.

Open your functions.php and add this code:

01 function publish_later_on_feed($where) {
02     global $wpdb;
04     if ( is_feed() ) {
05         // timestamp in WP-format
06         $now = gmdate('Y-m-d H:i:s');
08         // value for wait; + device
09         $wait = '10'; // integer
11         //
12         $device = 'MINUTE'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
14         // add SQL-sytax to default $where
15         $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
16     }
17     return $where;
18 }
20 add_filter('posts_where', 'publish_later_on_feed');

This code is adding a 10 minute delay on your post being shown on the RSS Feeds, you can change it by changing the number 10 to as many minutes as you like.

3. Insert Ads in Your RSS Feeds

Making money is the concept that everyone likes, but monetizing gets hard at times. This is just another way you can monetize by inserting ads in your RSS Feeds. Feedburner does it for you, but it is only Adsense Ads, and there is a subscriber count limit. This short snippet will help you insert ads, or anything else for that matters in your RSS Feeds.

Open your functions.php and add the following code:

1 <?php
2 function insertAds($content) {
3 $content = $content.'<hr />Check out Awesome WordPress Tips and Resources at <a href="">WPBeginner!</a><hr />';
4 return $content;
5 }
6 add_filter('the_excerpt_rss', 'insertAds');
7 add_filter('the_content_rss', 'insertAds');
8 ?>

If you don’t have a functions.php file in your theme folder then simply create one. Once you have uploaded this file, you are now displaying ads in your RSS Feeds.

This hack uses an add_filter() function which does not modify your core files at all. Many other hacks ask you to modify your core files which is a bad idea because you will need to modify everytime when you reinstall WordPress.

4. Display Any RSS Feed on Your Blog


There are often times when bloggers want to display RSS Feeds of other sites on their blog. Maybe it is from another blog of theirs that is related. This is when this hack comes handy because it makes your job much easier. There are several scripts and plugins that will do it for you, but you don’t need those because WordPress has this feature built in. And you should know that because you see the feeds in your Admin Panel Dashboard.

All you have to do is paste the following code where you want the feeds to be displayed. Most commonly placed in sidebar.php:

1 <?php include_once(ABSPATH.WPINC.'/rss.php');

Save the file and Upload it and you are done.

The function we used in this hack wp_rss is built in WordPress for future reference.

5. Exclude a Specific Category from RSS Feeds


There are certain categories that contain maybe link love and others which most of your users are not interested in. This is the option to satisfy those users. You can exclude a specific category by using a plugin called Advanced Category Excluder, or you can do it manually by using the code below:

To exclude multiple cateogries, just use the ampersand symbol:

If you don’t want to use the plugin and don’t want to do it manually with the link. There is another way which you can use by editing your function.php. Paste the following code in it:

1 function myFilter($query) {
2 if ($query-&gt;is_feed) {
3 $query-&gt;set('cat','-5'); //Don't forget to change the category ID =^o^=
4 }
5 return $query;
6 }
8 add_filter('pre_get_posts','myFilter');

6. Make a Separate RSS Feed for Each Category

Often times bloggers wonder how to make separate RSS feed for their category. Because sometimes your user only visits your website for the design category, but you have ten other categories that the user is not interested in. This hack will take care of this issue. (Source)

All you have to do is add the word feed in front of the category URL, and it will take you to the feed for that specific category.

7. List RSS Feeds by Each Category

Last hack shows you how you can have a separate RSS Feed. This snippet will let you list your category feeds by each category.


1 <?php wp_list_categories('feed_image= Feed&optioncount=1&children=0'); ?>

You must make sure to change the URL of the image because this will display RSS icon in front of each category.

8. Redirect WordPress Feeds to FeedBurner feeds.

We all want to have the most accurate subscriber count for our blogs. Feedburner provides us with a count of how many users have subscribed to the blog via feedburner feeds. Now WordPress by default has its own feeds to, so if someone types in then they should be sent to the WordPress version of the feed, and they can subscribe to that. But they will not be counted. One way you can solve this issue is by redirecting your WordPress feed to your FeedBurner feeds by using this short snippet of code:

Paste it in your .htaccess file located in the root folder.

1 # temp redirect wordpress content feeds to feedburner
2 <IfModule mod_rewrite.c>
3 RewriteEngine on
4 RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
5 RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
6 RewriteRule ^feed/?([_0-9a-z-] )?/?$ [R=302,NC,L]
7 </IfModule>

Make sure that you change the feed url to your FeedBurner url. This can also be done with a plugin called FeedBurner FeedSmith.

9. Disable RSS Feeds in WordPress

Do you want to use WordPress strictly as a static website. Then it might make sense that you disable your RSS Feeds. You can go to the wp-settings.php and remove one code but that will be stupid because it is a core file. Instead what you should do is use the following code and paste it in your functions.php

1 function fb_disable_feed() {
2     wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
3     }
5     add_action('do_feed', 'fb_disable_feed', 1);
6     add_action('do_feed_rdf', 'fb_disable_feed', 1);
7     add_action('do_feed_rss', 'fb_disable_feed', 1);
8     add_action('do_feed_rss2', 'fb_disable_feed', 1);
9     add_action('do_feed_atom', 'fb_disable_feed', 1);


Smashing Magazine