links_add_base_url

The timeline below displays how wordpress function links_add_base_url has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Adds a base URL to relative links in passed content.
 *
 * By default, this function supports the 'src' and 'href' attributes.
 * However, this can be modified via the `$attrs` parameter.
 *
 * @since 2.7.0
 *
 * @global string $_links_add_base
 *
 * @param string $content String to search for links in.
 * @param string $base    The base URL to prefix to links.
 * @param array  $attrs   The attributes which should be processed.
 * @return string The processed content.
 */
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);
}

WordPress Version: 6.1

/**
 * 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.
 *
 * @since 2.7.0
 *
 * @global string $_links_add_base
 *
 * @param string $content String to search for links in.
 * @param string $base    The base URL to prefix to links.
 * @param array  $attrs   The attributes which should be processed.
 * @return string The processed content.
 */
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);
}

WordPress Version: 4.3

/**
 * 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.
 *
 * @since 2.7.0
 *
 * @global string $_links_add_base
 *
 * @param string $content String to search for links in.
 * @param string $base    The base URL to prefix to links.
 * @param array  $attrs   The attributes which should be processed.
 * @return string The processed content.
 */
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);
}

WordPress Version: 3.7

/**
 * 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.
 *
 * @since 2.7.0
 *
 * @param string $content String to search for links in.
 * @param string $base The base URL to prefix to links.
 * @param array $attrs The attributes which should be processed.
 * @return string The processed content.
 */
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);
}