This page redirects to an external site: https://developer.wordpress.org/reference/functions/fetch_rss/
Retrieves an RSS feed and parses it. 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.
<?php
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss($uri);
?>
To get and display a list of links for an existing RSS feed, limiting the selection to the most recent 5 items:
<h2><?php _e('Headlines from AP News'); ?></h2>
<?php // Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/rss.php');
$rss = fetch_rss('http://example.com/rss/feed/goes/here');
$maxitems = 5;
$items = array_slice($rss->items, 0, $maxitems);
?>
<ul>
<?php if (empty($items)): ?>
<li>No items</li>
<?php else:
foreach ( $items as $item ):
?>
<li>
<a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'>
<?php echo $item['title']; ?>
</a>
</li>
<?php
endforeach;
endif;
?>
</ul>
fetch_rss is defined in wp-includes/rss.php.