Modify XML feeds in WordPress RSS feeds

Question

I have needed to modify the <link> attribute of an individual RSS item. here is the code I am currently running but this adds another <link> 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 <item> 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.

0
, , Shwmae 4 years 2019-11-05T07:13:59-05:00 0 Answers 73 views 0

Leave an answer

Browse
Browse