I'm trying to implement a custom RSS feed that is formatted for podcasting and pulls in the audio file from an Advanced Custom Field. Basically I've been working off of the example provided here: https://css-tricks.com/roll-simple-wordpress-podcast-plugin/

My plugin looks like this:

// add a custom RSS feed
function podcast_rss(){
    add_feed('podcast', 'run_podcast_rss');
add_action('init', 'podcast_rss');

function run_podcast_rss(){
    require_once( dirname( __FILE__ ) . '/feed-template.php' );

This seems pretty straightforward, but when I navigate in my browser to my new feed URL (http://example.com/feed/podcast/) The browser tries to download a file. In Google Chrome, the console shows

Resource interpreted as Document but transferred with MIME type application/octet-stream: "http://example.com/feed/podcast/".

While in Firefox, when it attempts to download the file, it tells me it's a DMS file.

I've tried clearing cache, checking for errors in the code, checking .htaccess for odd settings, setting headers; nothing seems to have an effect. In fact, I can comment out the require_once line and simply try to echo plain text. It still forces a download. I've put this on a different server and it behaves the same.

I have a feeling it's something simple but I'm out of ideas. Any help?

  • What is the content of that file?
    – fuxia
    Mar 22, 2016 at 21:54
  • If I just echo a string, the file contains the string. If I require_once that template file, it will usually throw an error into the file. For example, if I comment out a part like /* ... */ it errors out on the start of the comment. Mar 23, 2016 at 0:12
  • Did you check the line endings in that file?
    – fuxia
    Mar 23, 2016 at 2:42
  • The file is not being FTPd; it's running on a Vagrant/VirtualBox server on my machine and still has this behavior. Mar 24, 2016 at 1:41

2 Answers 2


You need to explicitly set the Content Type, otherwise WordPress defaults to octet-stream for unknown feeds.

function run_podcast_rss(){
    header( 'Content-Type: application/rss+xml; charset=' . get_option( 'blog_charset' ), true );
    require_once( dirname( __FILE__ ) . '/feed-template.php' );

As @mrfolkblues pointed out you need to add a filter for the feed_content_type. The code below solved the file download issue for me.

Code credit @swissspidy. https://core.trac.wordpress.org/ticket/36334#comment:7

// Example B:

function trac_36334_add_superduperfeed() {
        add_feed( 'superduperfeed', 'trac_36334_superduperfeed_cb' );

add_action( 'init', 'trac_36334_add_superduperfeed' );

function trac_36334_superduperfeed_cb() {
        header( 'Content-Type: text/html' ); // or any other content type
        echo 'Do something...';

function trac_36334_superduperfeed_type( $content_type, $type ) {
        if ( 'superduperfeed' === $type ) {
                return feed_content_type( 'rss2' );

        return $content_type;

add_filter( 'feed_content_type', 'trac_36334_superduperfeed_type', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.