Uma área de pesquisa sobre o WordPress para devs e autores do tema



links_add_base_url ›

Desde2.7.0
Obsoleton/a
links_add_base_url ( $content, $base, $attrs = array( 'src', 'href' ) )
Parâmetros: (3)
  • (string) $content String to search for links in.
    Required: Yes
  • (string) $base The base URL to prefix to links.
    Required: Yes
  • (array) $attrs The attributes which should be processed.
    Required: No
    Padrão: array( 'src', 'href' )
Retorna:
  • (string) The processed content.
Definido em:
Codex:

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.



Fonte

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