From 8528ff2ab4eb5d34c457e5ee957cf0f01b07f938 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 20 Aug 2015 06:09:28 +0000 Subject: [PATCH] Ensure that feeds are served with the proper `Content-Type` HTTP header. Props stevenkword. Fixes #32024. git-svn-id: https://develop.svn.wordpress.org/trunk@33658 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php index b5d9f91c24..69a45ada48 100644 --- a/src/wp-includes/class-wp.php +++ b/src/wp-includes/class-wp.php @@ -366,6 +366,13 @@ class WP { } elseif ( empty( $this->query_vars['feed'] ) ) { $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset'); } else { + // Set the correct content type for feeds + $type = $this->query_vars['feed']; + if ( 'feed' == $this->query_vars['feed'] ) { + $type = get_default_feed(); + } + $headers['Content-Type'] = feed_content_type( $type ) . '; charset=' . get_option( 'blog_charset' ); + // We're showing a feed, so WP is indeed the only thing that last changed if ( !empty($this->query_vars['withcomments']) || false !== strpos( $this->query_vars['feed'], 'comments-' )