You can use the template tag is_feed()
to determine if the current request is for a feed:
if ( is_feed() ) {
// It's a feed!
} else {
// Regular 'ol WordPress
}
Note you’ll need to use the function after the request has been parsed (i.e. on or after the parse_query
hook).