Yoast/wordpress-seo — pull request #1216 by dannyvankooten (2014-06-12 12:50:23+00:00)
Title: Use `wp` filter to detect site map requests. Only invalidate main query ...

...and make sure $wp_query is set.

This fixes a bug in older versions of the WordPress development / test suite.

Also, is it necessary to check for sitemap requests in every query, which is what `pre_get_posts` does? I changed the hook to `wp` in this PR but another option might be to check for `is_main_query()` inside the callback `redirect` method.

```
/**
* Hijack requests for potential sitemaps and XSL files.
*/
function redirect( $query ) {

if( ! $query->is_main_query() ) {
return;
}

$xsl = get_query_var( 'xsl' );
....
```