This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.


Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Warning: foreach() argument must be of type array|object, string given in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 794

Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789
_links_add_target( string $m )

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


Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Warning: foreach() argument must be of type array|object, string given in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 794

Warning: Array to string conversion in /var/www/public/docs.classicpress.net/public_html/wp-content/themes/cpnet-developer/inc/template-tags.php on line 789

Parameters

$m

(Required) The matched link.


Return

(string) The processed link.


Source

File: wp-includes/formatting.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 ) . '">';
}

Changelog

Changelog
Version Description
2.7.0 Introduced.