I'm trying to add some custom elements to a site's RSS feed. I thought it would be as simple as adding something like this to the active theme's functions.php:

function add_fields_to_videocast_rss_item() {
    echo "<test>This is a test</test>";
add_action('rss2_item', 'add_fields_to_videocast_rss_item');

However, when I call the feed URL at: http://my.site.com/feed this code never gets executed. In fact functions.php isn't used. This doesn't match with the official docs on this in de WP Codex.

Anything I'm missing here?


I think it's help for you. just try to implement this.


  • Answers should not rely on external links. The link also does not appear to answer the question that was asked.
    – Milo
    Jan 12 '18 at 5:30
  • Thanks for the reply, but the problem is that code from functions.php isn't executed on the feed URL. Even when I write a small plugin it's not being executed on the feed URL, only on regular pages.
    – Ruben
    Jan 12 '18 at 17:54

It turned out to be a fringe case that had more to do with the hosting platform than anything. The site was hosted at WPEngine and the caching system (Varnish) was throwing things off. Posting this just in case someone else ever walks into this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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