Adds element attributes to open links in new tabs.
Parameters
$text
stringrequired- Content to replace links to open in a new tab.
Source
function popuplinks( $text ) {
_deprecated_function( __FUNCTION__, '4.5.0' );
$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
return $text;
}
will output
Please visit WordPress.com
Basic usage:
Will output:
[html]
Please visit <a href="http://www.wordpress.com" target=’_blank’ rel=’external’>WordPress.com</a>
[/html]