I’m sure you’re right on both counts, I don’t know much about feeds, as you probably surmised. I should have known the header template is not used though ?? So you do need to hook an action from functions.php. The ‘wp-head’ action won’t work, it’s for regular headers.
A quick look at the feed templates indicates it depends on which template you use. For the default RSS2, the action should be ‘rss2_head’, so try adding this to your functions.php:
add_action('rss2_head', 'feed_norobots');
function feed_norobots() {
echo '<xhtml:meta xmlns:xhtml="https://www.w3.org/1999/xhtml" name="robots" content="noindex" />';
}
Modify the action tag as needed if you use a different template, and double check the feed to ensure the tag ended up in the right place.
The previous code should still work for trackbacks, IF I understand how they work, though of course you can remove the is_feed()||
part.