0

From what I've found online, getting an rss feed for a custom post type is as simple as:

http://mywebsite.com/feed/?post_type=custom_type

Well I have tried it with no success as it just returns the default feed. However I can get this to work on the website just fine with

http://mywebsite.com/?post_type=custom_type

So why does it work for the html but not the rss feed? Please advise.

** EDIT **

I ended up adding this to my theme's functions.php:

function myfeed_request($qv) {
    if (isset($qv['feed']) && isset($_GET['post_type'])) {
        //$qv['post_type'] = get_post_types();
        $qv['post_type'] = explode(',', $_GET['post_type']);
    }

    return $qv;
}
add_filter('request', 'myfeed_request');

1 Answer 1

1

Use this to include post types to your feed:

function myfeed_request($qv) {
   if (isset($qv['feed']))
   $qv['post_type'] = get_post_types();
   return $qv;
}
add_filter('request', 'myfeed_request');

Just add it to your functions.php. This should help.

Source.

1
  • I modified a line of your code and viola. See my edit.
    – Jacksonkr
    Aug 15, 2012 at 18:57

Your Answer

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

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