[wp-trac] [WordPress Trac] #36334: Custom RSS feed has wrong MIME type and forces download in browser

WordPress Trac noreply at wordpress.org
Thu Apr 7 11:58:49 UTC 2016


#36334: Custom RSS feed has wrong MIME type and forces download in browser
--------------------------+-----------------------
 Reporter:  Missilesilo   |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  Feeds         |     Version:  2.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------
Changes (by mpol):

 * status:  closed => reopened
 * resolution:  invalid =>


Comment:

 Posting again and re-opening :).
 I would think filtering feed_content_type is for adding a custom
 content_type. If using $type='rss' there is no need to filter this
 (correct?).
 I really think there is a bug here, because I don't think there is a way
 to set the correct header for a custom rss-feed.

 Using this code for example, will only add the header test-0 and test-1.
 But inside those first two functions it is not possible to set the
 Content-type header for just the feed that was added, it will just add it
 to any request.
 The third function will only run on that feed, but it is not possible to
 set a header anymore.
 Looking at all the code there is for RSS feeds, I suspect that once, long
 ago, it was possible to set a header inside this third function, so I
 would say this is a bug.

 {{{#!php
 <?php
 function gwolle_gb_rss_init(){
         add_feed('gwolle_gb', 'gwolle_gb_rss');
         header( 'X-Test-0: Test=0' );
 }
 add_action('init', 'gwolle_gb_rss_init');

 function gwolle_gb_rss_header() {
         header( 'X-Test-1: Test=1' );
         //header('Content-Type: ' . feed_content_type('rss') . ';
 charset=' . get_option('blog_charset'), true);
 }
 add_action( 'send_headers', 'gwolle_gb_rss_header' );

 function gwolle_gb_rss() {
         header( 'X-Test-2: Test=2' );
         header('Content-Type: ' . feed_content_type('rss') . '; charset='
 . get_option('blog_charset'), true);
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36334#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list