Alert: 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.

_links_add_target( string $m )

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

Description Description

Parameters Parameters


(string) (Required) The matched link.

Top ↑

Return Return

(string) The processed link.

Top ↑

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

Top ↑

Changelog Changelog

Version Description
2.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.