Set is_feed/feed so sitemap can be identified later in shutdown #7397

Merged
merged 1 commit into from Jul 1, 2017
@@ -137,6 +137,10 @@ public function __construct() {
private function serve_raw_and_die( $the_content_type, $the_content ) {
header( 'Content-Type: ' . $the_content_type . '; charset=UTF-8' );
+ global $wp_query;
+ $wp_query->is_feed = true;
+ set_query_var( 'feed', 'sitemap' );
+
if ( '' === $the_content ) {
wp_die(
esc_html__( "No sitemap found. Maybe it's being generated. Please try again later.", 'jetpack' ),
@@ -518,4 +522,4 @@ function jetpack_sitemap_uri( $filename = 'sitemap.xml' ) {
* @param string $sitemap_url Sitemap URL.
*/
return apply_filters( 'jetpack_sitemap_location', $sitemap_url );
-}
+}