is_feed() not working online
-
Hey guys,
I struggle solving this problem for a while now and decided to ask you. I use the following code to redirect my RSS feed links to FeedBurner:
add_action( 'template_redirect', 'feed_redirect' ); function feed_redirect() { if ( is_feed() && !preg_match( '/feedburner|feedvalidator/i', $_SERVER['HTTP_USER_AGENT'] ) ){ header( 'Location: https://feeds.feedburner.com/smaxtra-edition' ); header( 'HTTP/1.1 302 Temporary Redirect' ); } }
The strange thing is that this works just fine in my local testing environment (MAMP) but it does not work online at smaxed.com/feed.
is_feed() seems to return false which is not the way it is supposed to act, right? Any hints? Thanks in advance, I appreciate this!
Best regards,
StephanPS. I know that I can also try to use plugins or .htaccess redirects, but I thought using hooks is clean and sufficient.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘is_feed() not working online’ is closed to new replies.