How Redirect WordPress Feeds to Feedburner

I have been guilty of using a plugin for it in the past, but it simply isn’t necessary, with this small code snippet you can easily achieve the same results without loading a plugin.


/**
 *
 * Redirect WordPress Feeds to Feedburner
 */
if ( ! function_exists( 'ns_rss_redirect' ) ) {
function ns_rss_redirect() {
 if ( is_feed() && ! preg_match( '/feedburner|feedvalidator/i', $_SERVER[ 'HTTP_USER_AGENT' ] ) ){
  header( 'Location: http://feeds.feedburner.com/yourfeedname' );
  header( 'HTTP/1.1 302 Temporary Redirect' );
 }

}
add_action( 'template_redirect', 'ns_rss_redirect' );
}

Obviously, you should replace “your feed name” with your Feedburner feed name.

source: 10 Tips optimize WordPress theme

ABOUT AUTHOR

Nuno

I am a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.

  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.

  • This form collects your name and email address so that I can respond to the enquiry(ies) that you submit via this website. Please check my privacy policy for the full story on how I use, protect and manage your submitted data.