make_url_footnote( string $content ): string
- Since
- 0.71
- Source
wp-includes/deprecated.php:1734
Description
Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers.
Compatibility
Deprecated in WordPress 2.9.0. Kept for back-compatibility; avoid it in new code.
- WordPress
- since 0.71
- 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
$contentstring- Content to get links.
Return value
string- HTML stripped out of content with links at the bottom.
Performance profile
How much work a call to make_url_footnote() 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
- Heavy
- Scaling
- Scales with input
- Instructions
- 24
- Plugin surface
- None
- Called by
- 1
Reads stored settings via get_option(), cached per request but not free on a cold cache.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5. The body compiles to 68.
Nothing here hands control to plugin code.
1 place in core call this, so the cost is paid more often than your own code shows.
What it touches
- optionoption read or write
get_option()called directly - regexregular expression over the whole input
preg_match_all()called directly - hookthird-party callbacks
do_action()one call below make_url_footnote() - cacheobject cache
wp_cache_get()one call below make_url_footnote() - serializeserialisation
maybe_unserialize()one call below make_url_footnote()
Further down the call graph this can also reach query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 1 distinct outcome
One number would be a lie: the work depends on which branch runs. These are every distinct cost make_url_footnote() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!$i | 24 | _deprecated_function(), preg_match_all(), strip_tags() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 68 | 24 | 3 | |
| 8.5 | 68 | 24 | 3 | |
| 8.4 | 68 | 24 | 3 | 9 fewer instructions than PHP 8.3 |
| 8.3 | 77 | 24 | 3 | |
| 8.2 | 77 | 24 | 3 | |
| 8.1 | 77 | 24 | 3 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 78 | 24 | 3 |
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 · 2
- _deprecated_function()Marks a function as deprecated and inform when it has been used.
- get_option()Retrieves an option value based on an option name.
Used by · 1
- the_content_rss()Display the post content for the feed.
Source code
function make_url_footnote( $content ) { _deprecated_function( __FUNCTION__, '2.9.0', '' ); preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches ); $links_summary = "\n"; for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) { $link_match = $matches[0][$i]; $link_number = '['.($i+1).']'; $link_url = $matches[2][$i]; $link_text = $matches[4][$i]; $content = str_replace( $link_match, $link_text . ' ' . $link_number, $content ); $link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) !== 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) !== 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url; $links_summary .= "\n" . $link_number . ' ' . $link_url; } $content = strip_tags( $content ); $content .= $links_summary; return $content;}Changelog
Introduced in 0.71. 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 6.9.7 tag, from
src/wp-includes/deprecated.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.