WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add some code to my RSS feeds, so I am searching for the RSS Feed .php file so I can add my code. Any help in finding this template file would be greatly appreciated.

share|improve this question

To add some tags to the rss2 feed you may use the 3 action hooks that can be found in the wp-includes/feed-rss2.php

rss2_ns : to add a specific namespace

rss2_head : to add tags in the feed header

rss2_item : to add tags in each feed items

For example, let's assume you want to add a copyright in your feed's header using the dublin core vocabulary :

function my_rss2_head(){
    echo '<dc:rights>&copy; '.bloginfo_rss('name').'</dc:rights>'.PHP_EOL;
add_action( 'rss2_head', 'my_rss2_head');
share|improve this answer

Feed templates are in wp-includes folder, files starting with feed-. As rest of the WordPress core they are not supposed to be modified.

You will need to:

  1. Determine type of feed you want to modify (usually default RSS 2.0 one).
  2. Unhook native function that loads feed template, for example remove_action('do_feed_rss2','do_feed_rss2');
  3. Create your own feed template.
  4. Create and hook your own function that will load your template, by analogue with do_feed_rss2() ( source ).

Alternatively you can use some specific hooks in feed template to add what you want.


As per Otto's comment steps 2 and 4 can be simplified using add_feed() function ( source ).

share|improve this answer
A fine answer, but I'd recommend using the add_feed function instead. You can use it to replace a feed as well as add new ones. – Otto Feb 3 '11 at 8:02
@Otto thanks for hint, looked at source and that would be much less cluttered to use indeed – Rarst Feb 3 '11 at 8:18

Here's a quick guide: http://codex.wordpress.org/Customizing_Feeds

share|improve this answer
Some of the stuff in that article is verrrry old (as per warnings). I'd not rely on it without double checking with other materials and/or source code. – Rarst Feb 2 '11 at 20:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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