Redirect Your WordPress Feed to Feedburner

We’ve been doing quite a bit of Marketing the past couple of weeks and one of our initiatives was to better track our readers. Like most business websites, we use Feedburner for RSS & email syndication.

Not only does it make it easier for people to subscribe to our outbound communication channels, Feedburner also gives us the analytical tools to dig into the data.

As we launch new sites (most recently our AppThemes WordPress Marketplace), certain steps are taken before public release. One of which is setting up a new feed and pointing it to Feedburner.

Pointing your feed to Feedburner

Unlike many other tutorials that instruct you to edit your theme’s header.php file (which is the wrong way), we recommend creating a child theme or adding the following function to your functions.php file.

// replace the default posts feed with feedburner
function appthemes_custom_rss_feed( $output, $feed ) {
    if ( strpos( $output, 'comments' ) )
        return $output;
 
    return esc_url( 'http://feeds.feedburner.com/AppThemes/' );
}
add_action( 'feed_link', 'appthemes_custom_rss_feed', 10, 2 );

What this does is dynamically change your main posts feed (rss, rss2, atom, and rdf) throughout your site. It ignores the comments feed.

Test it out by going to http://www.yoursite.com/feed/. You should be prompted to subscribe via Feedburner and then you’re done!

Bonus Points

Besides your main site’s feed, there are feeds for each tag, category, taxonomy, author, and search. If you wanted to point these to Feedburner as well, you’d use the following filters:

add_filter( 'tag_feed_link', 'custom_tag_rss_feed' );
add_filter( 'category_feed_link', 'custom_cat_rss_feed' );
add_filter( 'taxonomy_feed_link', 'custom_tax_rss_feed' );
add_filter( 'author_feed_link', 'custom_author_rss_feed' );
add_filter( 'search_feed_link','custom_search_rss_feed' );

For example, we created a separate Feedburner feed just for our tutorials category. This allows people to read just our awesome tutorials without having to sort through everything that comes from our Docs site. You can see it available on our AppThemes subscribe page.

function appthemes_custom_cat_rss_feed( $output ) {
    if ( strpos( $output, '/tutorials/feed' ) )
        return $output = esc_url( 'http://feeds.feedburner.com/AppThemesMarketplace/' );
    else
	return $output;
}
add_filter( 'category_feed_link', 'appthemes_custom_cat_rss_feed' );

Summary

Creating separate Feedburner feeds for all your categories, authors, etc would be laborious and not worth doing. Either just provide your main rss feed or pick a few top categories that your readers might want direct feeds to.

Like this tutorial? Subscribe and get the latest tutorials delivered straight to your inbox or feed reader.

Your rating: none
Rating: 4.5 - 8 votes

Popular Add-ons

Selected ads For Classipress

Display Selected ads widget for Classipress


(1)
$12

Daddy Like

A fast, lightweight, and elegant "like" system for comments, pages, posts,…


(12)
$19

ClassiPress Video Embed

Allow users to embed video from YouTube & Vimeo into their ad listings…


(3)
$12