Warning: This function has been deprecated.

make_url_footnote() WordPress Function

The make_url_footnote() function allows you to create a footnote for a URL. This is useful when you want to provide more information about a link, or when you want to credit the source of a link.

make_url_footnote( string $content ) #

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.


Top ↑

Parameters

$content

(string)(Required)Content to get links.


Top ↑

Return

(string) HTML stripped out of content with links at the bottom.


Top ↑

Source

File: wp-includes/deprecated.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
2.9.0This function has been deprecated.
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More