Trying to refactor a feed plugin to fallback on cache if source is unavailable (ex: for maintenance).
fetch_feed($url); which affords more flexibility in terms of cache. But unsure of how to structure the fallback.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
Sounds like you are looking at it from a very low layer POV.
fetch_feed provides caching so you will not need to wait for a response on possibly every page load. Therefor, as long as there is a cache you are unlikely to even want a message to be sent and obviously you are not handling any actual result. It is unlikely that you will want to hurt your server with a faster refresh rate just to be able to properly detect the conditions on the other side.
What you should do is to handle the situation of not getting a reply, which is probably equal to empty feed, to supply the defaults you want.