How to Change the Default URL for RSS Feed in WordPress

The default RSS URL for WordPress is http://your-site.com/feed/. Theme makers and developers use the default RSS URL every where on a theme.

This default URL is retrieved by using the WordPress template tag bloginfo(‘rss_url’).

But, what if you use FeedBurner or a similar service? How do you tell WordPress, its themes, and its plugins to show your own custom RSS link instead of the default?

Here’s how. Paste the following code into the functions.php file of your theme:

function my_rss_link($output, $show)
{
	if (in_array($show, array('rss_url', 'rss2_url', 'rss', 'rss2', '')))
		$output = 'http://feeds.feedburner.com/winkpress';
 
	return $output;
}
add_filter('bloginfo_url', 'my_rss_link', 10, 2);
add_filter('feed_link', 'my_rss_link', 10, 2);

That’s it.

Now whenever bloginfo(‘rss_url’) or bloginfo(‘rss2_url’) is called, it’ll show your custom RSS feed link. Don’t forget to replace my RSS URL with your own above.

Some people may still be using your old RSS link or they may try to manually add /feed/ to your site’s domain. You can have this URL redirect to your custom RSS feed.

Paste the following code in your .htaccess file:

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
 RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
 RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/wprecipes [R=302,NC,L]
</IfModule>

7 comments. You can post one, too!

  1. Thanks for this, very useful post and has helped me out a lot!

  2. However, if something goes wrong with the auto air conditioning compressor the transit will be much warmer. LR<

  3. Hey there! Quick question that’s entirely off topic. Do you know how to make your site mobile friendly? My web site looks weird when viewing from my apple iphone. I’m trying to find a template or plugin that might be able to correct this problem.

    If you have any recommendations, please share. Thanks!

  4. it works fine !!

  5. Thanks, this was just what I was looking for.

  6. Thank you!! That worked like a charm :)

Leave a comment

Your email address will not be published. Required fields are marked *

*

Read this to make your comment cool.