This page redirects to an external site: https://developer.wordpress.org/reference/functions/get_rss/
Retrieves an RSS feed and parses it, then displays it as a list of links. The get_rss() function only outputs the list items, not the surrounding list tags itself.
Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval.
Deprecated note: Switch to using fetch_feed instead.
<code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">require_once(</span><span style="color: #0000BB">ABSPATH </span><span style="color: #007700">. </span><span style="color: #0000BB">WPINC </span><span style="color: #007700">. </span><span style="color: #DD0000">'/rss-functions.php'</span><span style="color: #007700">); </span><span style="color: #0000BB">get_rss</span><span style="color: #007700">(</span><span style="color: #0000BB">$uri</span><span style="color: #007700">, </span><span style="color: #0000BB">$num </span><span style="color: #007700">= </span><span style="color: #0000BB">5</span><span style="color: #007700">); </span><span style="color: #0000BB">?></span></code>
The get_rss() function only outputs the list items, not the surrounding list tags itself. So, to get and display an ordered list of 5 links from an existing RSS feed:
<code style="color: #000000"><span style="color: #0000BB"><?php </span><span style="color: #007700">require_once(</span><span style="color: #0000BB">ABSPATH </span><span style="color: #007700">. </span><span style="color: #0000BB">WPINC </span><span style="color: #007700">. </span><span style="color: #DD0000">'/rss-functions.php'</span><span style="color: #007700">); echo </span><span style="color: #DD0000">'<ol>'</span><span style="color: #007700">; </span><span style="color: #0000BB">get_rss</span><span style="color: #007700">(</span><span style="color: #DD0000">'http://example.com/rss/feed/goes/here'</span><span style="color: #007700">); echo </span><span style="color: #DD0000">'</ol>'</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></code>
The output from the above example will look like the following:
<code style="color: #000000"><ol> <li><a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a><br /></li> (repeat for number of links specified) </ol></code>