links_add_base_url() – Add a Base url to relative links in passed content.
You appear to be a bot. Output may be restricted
Description
Adds a base URL to relative links in passed content.
By default it supports the 'src' and 'href' attributes. However this can be changed via the 3rd param.
Usage
$string = links_add_base_url( $content, $base, $attrs );
Parameters
- $content
- ( string ) required – String to search for links in.
- $base
- ( string ) required – The base URL to prefix to links.
- $attrs
- ( array ) optional default: Array – The attributes which should be processed.
Returns
string The processed content.
Source
File name: wordpress/wp-includes/formatting.php
Lines:
1 to 6 of 6
function links_add_base_url( $content, $base, $attrs = array( 'src', 'href' ) ) { global $_links_add_base; $_links_add_base = $base; $attrs = implode( '|', (array) $attrs ); return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content ); }