WordPress RSS File Template

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');

Leave a Comment