How can I make a separate RSS feed for each custom post type?
I had searched the net for it and found suggestions to do something like this:
I tried the above, but it just didn’t work! It only takes me back to the custom post type archive page again…
Does anybody knows where I went wrong or what I am missing???
FYI, I used the Custom Post Permalinks plugin to allow post type specific permalinks for post type archive pages. Not sure if this may affect the RSS feed problem.
Cheers!
add the small example function:
Alternative you can creat a own feed onl yfor the custom post type. See the follow example for a “Draft Feed” of draft posts.
You should be able to get the feed by going to http://www.yoursite.com/?feed=rss2&post_type=your_post_type as long as the post type is set to be publicly_queryable.
Okay, thanks to all who contributed to answering my question, but I had finally figured out the solution to my problem.
Sorry for being naive but it turned out that I had a template_redirect action added to direct anything that’s related to my post types to their respective template files. Something like this:
It, apparently, also redirected my post-type feeds to the template files, thus “it only takes me back to the custom post type archive page again…’
So I just added an extra filter to exclude feeds from this redirection, that is, I added !is_feed() in the if statement:
…and the feeds work as they should be again. I knew there was something wrong with the theme…
Thanks again for the help, guys! 🙂
I believe you just need to add a query string with your custom post type’s (CPT) slug.
For example, https://www.domain.com/feed/?post_type=your_post_type