There are a lot of tutorials floating around the internet that describe how to create a custom RSS feed in WordPress. Most of them have you creating a new page template, copying the code that WordPress uses to generate feeds into the page template, and adding to and modifying the code there.
In addition to all of the duplicated RSS code in the template, and the maintenance burden that creates, most of these tutorials exhibit poor coding practices, security vulnerabilities, and do not make use of core WordPress functionality. Having been frustrated with all of the bad tutorials out there, I decided to do something about it and write my own tutorial showing how to create a custom RSS feed in WordPress the right way.
If you just want to see the code, head over to this post’s example repository on GitHub. Otherwise, keep reading.
Continue reading