popuplinks()WP 0.71

Deprecated from version 4.5.0. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Adds element attributes to open links in new tabs.

No Hooks.

Return

String. Content that has filtered links.

Usage

popuplinks( $text );
$text(string) (required)
Content to replace links to open in a new tab.

Examples

0

#1 Demo

$text = "Sample text for the popuplinks function that 
replaces the <a href='http://domen.ru'>link</a> in the text with one, 
but in external attributes."

echo popuplinks( $text );

the link from this example would be like this:

<a href='http://domen.ru' target='_blank' rel='external'>link</a>

Changelog

Since 0.71 Introduced.
Deprecated since 4.5.0

popuplinks() code WP 6.5.3

function popuplinks( $text ) {
	_deprecated_function( __FUNCTION__, '4.5.0' );
	$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
	return $text;
}