WordPress at a glance
function is not described

_links_add_target() WP 2.7.0

Callback to add a target attribute to all links in passed content.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.

Return

String. The processed link.

Usage

_links_add_target( $m );
$m(string) (required)
The matched link.

Notes

  • Global. String. $_links_add_target

Changelog

Since 2.7.0 Introduced.

Code of _links_add_target() WP 5.7.2

<?php
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 ) . '">';
}