OK. So I think I figured this one out myself. I’ll document it here for the sake of those who may fall into the same trap.
I’ve been using a template file to structure my feed. In my functions.php
file, this is what the relevant portions of code looked like before:
add_feed('weekly_deals', 'weekly_deals_create_feed');
function weekly_deals_create_feed(){
# for the sake of cleanliness, simply include a template file here
include get_template_directory() . "/weekly-deals-rss.php";
}
Via random Googling, I discovered to do this instead:
add_feed('weekly_deals', 'weekly_deals_create_feed');
function weekly_deals_create_feed(){
# for the sake of cleanliness, simply include a template file here
load_template(get_template_directory() . "/weekly-deals-rss.php");
}
The latter works, while the former simply doesn’t. Apparently WordPress somehow destroys (or otherwise makes unavailable) all of the environment data when using include
for templates like I did above.
Live and learn :/