fetch_rss( string $url ): MagpieRSS|false
- Since
- 1.5.0
- Source
wp-includes/rss.php:412
Compatibility
- WordPress
- since 1.5.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$urlstring- URL to retrieve feed.
Return value
MagpieRSS|false- MagpieRSS object on success, false on failure.
Performance profile
How much work a call to fetch_rss() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Constant
- Instructions
- 6–96
- Plugin surface
- None
- Called by
- 2
Reaches an outbound HTTP request via wp_safe_remote_request().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 156.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- httpoutbound HTTP request
wp_safe_remote_request()one call below fetch_rss()
Further down the call graph this can also reach hook. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 117 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost fetch_rss() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($url) | 6 | init() |
isset($url) && !is_success() | 18–61 | init(), _fetch_remote_file(), is_success() |
isset($url) && is_success() | 21–50 | init(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" | 34–39 | init(), _fetch_remote_file() |
isset($url) && $cache && $cache_status == "HIT" && isset($rss) | 36–38 | init(), ->get() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" | 38–43 | init(), ->check_cache(), _fetch_remote_file() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" | 40–43 | init(), _fetch_remote_file(), debug() |
isset($url) && $cache | 40–53 | init(), ->get(), _fetch_remote_file() |
isset($url) && $cache && $cache_status == "HIT" && isset($rss) | 40–42 | init(), ->get(), debug() |
isset($url) && !$cache && $cache_status == "HIT" && isset($rss) | 40–42 | init(), ->check_cache(), ->get() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" | 42–45 | init(), debug(), _fetch_remote_file() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 44–46 | init(), _fetch_remote_file(), ->set() |
105 further outcomes, up to 96 instructions
isset($url) && $cache && $cache_status == "HIT" && isset($rss) | 44 | init(), debug(), ->get() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" | 44–47 | init(), ->check_cache(), _fetch_remote_file(), debug() |
isset($url) && !$cache | 44–57 | init(), ->check_cache(), ->get(), _fetch_remote_file() |
isset($url) && !$cache && $cache_status == "HIT" && isset($rss) | 44–46 | init(), ->check_cache(), ->get(), debug() |
isset($url) && $cache | 46–57 | init(), ->get(), _fetch_remote_file(), debug() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" | 46–60 | init(), ->get(), ->get(), _fetch_remote_file() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" | 46–49 | init(), debug(), ->check_cache(), _fetch_remote_file() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 48–50 | init(), _fetch_remote_file(), debug(), ->set() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 48–50 | init(), ->check_cache(), _fetch_remote_file(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" | 48–49 | init(), debug(), _fetch_remote_file(), debug() |
isset($url) && $cache | 48–59 | init(), debug(), ->get(), _fetch_remote_file() |
isset($url) && $cache && $cache_status == "HIT" && isset($rss) | 48 | init(), debug(), ->get(), debug() |
isset($url) && $cache_status == "HIT" && isset($rss) | 48 | init(), debug(), ->check_cache(), ->get() |
isset($url) && $cache && isset($resp) | 50–60 | init(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && !$cache | 50–61 | init(), ->check_cache(), ->get(), _fetch_remote_file(), debug() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" | 50–64 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 52 | init(), debug(), _fetch_remote_file(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" | 52–64 | init(), ->get(), ->get(), _fetch_remote_file(), debug() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 52–54 | init(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 52–54 | init(), ->check_cache(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" | 52–53 | init(), debug(), ->check_cache(), _fetch_remote_file(), debug() |
isset($url) | 52–63 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file() |
isset($url) && $cache_status == "HIT" && isset($rss) | 52 | init(), debug(), ->check_cache(), ->get(), debug() |
isset($url) && $cache && isset($resp) && is_success() | 54–64 | init(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && isset($resp) | 54–64 | init(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && !$cache && isset($resp) | 54–64 | init(), ->check_cache(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && $cache | 54–63 | init(), debug(), ->get(), _fetch_remote_file(), debug() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" | 54–66 | init(), debug(), ->get(), ->get(), _fetch_remote_file() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 55–57 | init(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 56–67 | init(), ->get(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 56 | init(), debug(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 56 | init(), debug(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 56 | init(), debug(), ->check_cache(), _fetch_remote_file(), ->set() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" | 56–68 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), debug() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 58–65 | init(), ->check_cache(), _fetch_remote_file(), is_success() |
isset($url) && $cache && isset($resp) | 58–66 | init(), debug(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 58–60 | init(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && !$cache && isset($resp) && is_success() | 58–68 | init(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && !$cache && isset($resp) | 58–68 | init(), ->check_cache(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) | 58–67 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), debug() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" | 58–70 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 59–61 | init(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 60–65 | init(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache && isset($resp) && !is_success() | 60–75 | init(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 60–71 | init(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 60–71 | init(), ->get(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 60–71 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" | 60–70 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), debug() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 60 | init(), debug(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) | 60 | init(), debug(), ->check_cache(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache && isset($resp) && is_success() | 61–71 | init(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 62–67 | init(), debug(), _fetch_remote_file(), is_success() |
isset($url) && $cache && isset($resp) && is_success() | 62–70 | init(), debug(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && isset($resp) | 62–70 | init(), debug(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && isset($resp) | 62–70 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 62–64 | init(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 63 | init(), debug(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && !$cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 64–69 | init(), ->check_cache(), _fetch_remote_file(), is_success(), debug() |
isset($url) && !$cache && isset($resp) && !is_success() | 64–79 | init(), ->check_cache(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 64–73 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && $cache && isset($resp) && is_success() | 64–74 | init(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 64–75 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 64–75 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" | 64–74 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), debug() |
isset($url) && !$cache && isset($resp) && is_success() | 65–75 | init(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && isset($resp) && !is_success() | 66–79 | init(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 66–82 | init(), ->get(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 66–71 | init(), debug(), ->check_cache(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 66 | init(), debug(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && isset($resp) && is_success() | 66–74 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && isset($resp) | 66–74 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 67–78 | init(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 67 | init(), debug(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 68–71 | init(), debug(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache && isset($resp) && !is_success() | 68–81 | init(), debug(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 68–77 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 68–77 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 68–77 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), ->set() |
isset($url) && !$cache && isset($resp) && is_success() | 68–78 | init(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache && isset($resp) && is_success() | 69–77 | init(), debug(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && !$cache && isset($resp) && !is_success() | 70–83 | init(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 70–86 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 70–81 | init(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && is_success() | 70 | init(), debug(), ->check_cache(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 71–82 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 72–86 | init(), ->get(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache_status != "HIT" && $cache_status != "STALE" && isset($resp) && !is_success() | 72–75 | init(), debug(), ->check_cache(), _fetch_remote_file(), is_success(), debug() |
isset($url) && isset($resp) && !is_success() | 72–85 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && isset($resp) && is_success() | 72–80 | init(), debug(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 72–81 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) | 72–81 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), debug(), ->set() |
isset($url) && isset($resp) && is_success() | 73–81 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && isset($resp) && !is_success() | 74–85 | init(), debug(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 74–88 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 74–85 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 75–84 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && !$cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 76–90 | init(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && isset($resp) && is_success() | 76–84 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && isset($resp) && !is_success() | 78–89 | init(), debug(), ->check_cache(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 78–92 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 78–87 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 79–88 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), ->set() |
isset($url) && $cache && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 80–92 | init(), debug(), ->get(), ->get(), _fetch_remote_file(), is_success(), debug() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && is_success() | 82–91 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), _response_to_rss(), debug(), ->set() |
isset($url) && $cache_status == "HIT" && $cache_status == "STALE" && isset($resp) && !is_success() | 84–96 | init(), debug(), ->check_cache(), ->get(), ->get(), _fetch_remote_file(), is_success(), debug() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 156 | 6–96 | 23 | |
| 8.5 | 156 | 6–96 | 23 | |
| 8.4 | 156 | 6–96 | 23 | 4 fewer instructions than PHP 8.3 |
| 8.3 | 160 | 6–100 | 23 | |
| 8.2 | 160 | 6–100 | 23 | |
| 8.1 | 160 | 6–100 | 23 | |
| 7.4 | 160 | 6–100 | 23 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 5
- init()Set up constants with default values, unless user overrides.
- _fetch_remote_file()Retrieve URL headers and content using WP HTTP Request API.
- is_success()
- _response_to_rss()Retrieve
- RSSCache::__construct()PHP5 constructor.
Used by · 2
Changelog
Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/rss.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.