Modify XML feeds in WordPress RSS feeds

I have needed to modify the attribute of an individual RSS item. here is the code I am currently running but this adds another on the end of each RSS2 item.

<?php
function modify_rss_feed()
{
$output = ‘<link>’ . $mynewlink . ‘</link>;
echo $output;
}
add_action(‘rss2_item’, ‘modify_rss_feed’);
?>

An example XML may look like this

<item>
<title>This is a title link</title>
<link>https://shwmae.net/video/watch-this-space</link>
<pubDate>Sun, 03 Nov 2019 18:44:00 +0000</pubDate>
</item>

How am I able to modify the existing fields in the RSS output at https://my-site-example.com/feed/, https://my-site-example.com/category/category-one/feed/ etc.

Read more here:: <a href=https://wordpress.stackexchange.com/questions/351923/modify-item-xml-feeds-in-wordpress-rss-feeds target="_blank" title="Modify XML feeds in WordPress RSS feeds” rel=nofollow>Modify XML feeds in WordPress RSS feeds

Leave a Reply

Your email address will not be published. Required fields are marked *