A WordPress-centric search engine for devs and theme authors



_links_add_target ›

Since2.7.0
Deprecatedn/a
_links_add_target ( $m )
Access:
  • private
Parameters:
  • (string) $m The matched link.
    Required: Yes
Returns:
  • (string) The processed link.
Defined at:
Codex:

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



Source

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