Get RSS feed without feed.php and utilising Transient API

This function fetches an external RSS feed without feed.php and stores the data (caches) in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted using the Transient API.

Why not use WordPress’s fetch_feed?

In most cases you’d use fetch_feed as defined in wp-includes/feed.php, but in the rare situation where the server environment set up breaks the function I had to use SimpleXMLElement.

What are the benefits of using Transient API?

WordPress’s Transient API offers a way of storing cached data in the database temporarily. In this case, the external RSS feed is fetched and stored locally in the database for a period of time, so any subsequent visitors are accessing the local data. This improves performance resulting in faster page loads.