_links_add_target

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

WordPress Version: 4.3

/**
 * Callback to add a target attribute to all links in passed content.
 *
 * @since 2.7.0
 * @access private
 *
 * @global string $_links_add_target
 *
 * @param string $m The matched link.
 * @return string The processed link.
 */
function _links_add_target($m)
{
    global $_links_add_target;
    $tag = $m[1];
    $link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
    return '<' . $tag . $link . ' target="' . esc_attr($_links_add_target) . '">';
}

WordPress Version: 3.8

/**
 * Callback to add a target attribute to all links in passed content.
 *
 * @since 2.7.0
 * @access private
 *
 * @param string $m The matched link.
 * @return string The processed link.
 */
function _links_add_target($m)
{
    global $_links_add_target;
    $tag = $m[1];
    $link = preg_replace('|( target=([\'"])(.*?)\2)|i', '', $m[2]);
    return '<' . $tag . $link . ' target="' . esc_attr($_links_add_target) . '">';
}

WordPress Version: 3.7

/**
 * Callback to add a target attribute to all links in passed content.
 *
 * @since 2.7.0
 * @access private
 *
 * @param string $m The matched link.
 * @return string The processed link.
 */
function _links_add_target($m)
{
    global $_links_add_target;
    $tag = $m[1];
    $link = preg_replace('|(target=([\'"])(.*?)\2)|i', '', $m[2]);
    return '<' . $tag . $link . ' target="' . esc_attr($_links_add_target) . '">';
}