Complete Geek Boutique

Nothing in cyberspace is sacred

Redirect your WordPress RSS feed elsewhere

Redirect-RSSEver want to redirect your WordPress blog’s RSS feed to somewhere else – such as FeedBurner?

Go to your site’s root folder to “wp-content > themes > The theme you’re using > functions.php”, and open it in your favorite editor.

Just after the initial php line on Line No. 1 in your functions.php file (of the theme you’re using for your site), paste this code in on Line No. 2:

// CHANGES RSS FEED TO FEEDBURNER FEED LOCATION
function my_rss_link($output, $show)
{
if (in_array($show, array('rss_url', 'rss2_url', 'rss', 'rss2', '')))
$output = 'http://feeds.feedburner.com/yourfeedburnerrsslink';
return $output;
}
add_filter('bloginfo_url', 'my_rss_link', 10, 2);
add_filter('feed_link', 'my_rss_link', 10, 2);
// End Feedburner RSS redirect code

To make the code yours, just replace ‘/yourfeedburnerrsslink’ to the link where your blog’s RSS is housed.

EXAMPLE: Here’s how I configured the code for one of my news websites:

// CHANGES RSS FEED TO FEEDBURNER FEED LOCATION
function my_rss_link($output, $show)
{
if (in_array($show, array('rss_url', 'rss2_url', 'rss', 'rss2', '')))
$output = 'http://feeds.feedburner.com/CitrusTimesOnline';
return $output;
}
add_filter('bloginfo_url', 'my_rss_link', 10, 2);
add_filter('feed_link', 'my_rss_link', 10, 2);
// End Feedburner RSS redirect code

Just replace ‘/CitrusTimesOnline’ to the link where your blog’s RSS lives (such as FeedBurner). Note too, that if you change (or update) the theme you use, you will also have to go into that theme’s functions.php file and make this same change.

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Information

This entry was posted on April 5, 2014 by in Content Management Systems, Geek Tips, Php Scripts and tagged , , .
%d bloggers like this: