In my theme i use add_theme_support( 'automatic-feed-links' );
to enable the rss links.
But i want to create an option to use Feedburner for the main rss feed, my problem is that i don’t know how i can hook in and change the default rss link?
In my theme i use add_theme_support( 'automatic-feed-links' );
to enable the rss links.
But i want to create an option to use Feedburner for the main rss feed, my problem is that i don’t know how i can hook in and change the default rss link?
You must be logged in to post a comment.
You can take advantage of the
template_redirect
hook and redirect any request to the WordPress feed to a URL that you define.The most important thing to consider is the case when users are attempting to access the feed itself. In that case, you’d obviously not want to do any redirection.
Here’s how you can do that:
If you’re planning to redirect feeds for comment streams, too then you’ll need to add that to this function, as well.
Note that I’m unsure if using
die
is the best practice here – it gets the job done, but “feels” a bit weak (though it is better thanwp_die
since that function is designed to actually return an error message – not just halt execution).