WordPress at a glance
function is not described

links_add_base_url() WP 2.7.0

Add 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.

  • Global. String. $_links_add_base

No Hooks.


String. The processed content.


links_add_base_url( $content, $base, $attrs, fooo) );
$content(string) (required)
String to search for links in.
$base(string) (required)
The base URL to prefix to links.
The attributes which should be processed.
Default: array(foo

Code of links add base url: wp-includes/formatting.php VER 5.0.3

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