wppaste
WordPress

make_url_footnote( string $content ): string

Since
0.71
Source
wp-includes/deprecated.php:1737
Strip HTML and put links at the bottom of stripped content.

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

Reads stored settings via get_option(), cached per request but not free on a cold cache.

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
24

Executed per call on PHP 8.5. The body compiles to 68.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • optionoption read or writeget_option()called directly
  • regexregular expression over the whole inputpreg_match_all()called directly
  • hookthird-party callbacksdo_action()one call below make_url_footnote()
  • cacheobject cachewp_cache_get()one call below make_url_footnote()
  • serializeserialisationmaybe_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.

WhenInstructionsCalls it makes
!$i24_deprecated_function(), preg_match_all(), strip_tags()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev68243
8.568243
8.4682439 fewer instructions than PHP 8.3
8.377243
8.277243
8.1772431 fewer instruction than PHP 7.4
7.478243

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

Used by · 1

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

2.9.0
Deprecated.from the docblock
0.71
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 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.