On this page
make_url_footnote( string $content ): string
This function has been deprecated.
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.
Parameters
$contentstring Required-
Content to get links.
Return
string HTML stripped out of content with links at the bottom.
Source
File: wp-includes/deprecated.php. View all references
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;
}
Related
Uses
| Uses | Description |
|---|---|
| _deprecated_function() wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| the_content_rss() wp-includes/deprecated.php | Display the post content for the feed. |
Changelog
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/make_url_footnote