popuplinks()
Deprecated since 4.5.0. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.
Adds target="_blank" and rel="external" to links so that they open in a new window.
The comment text in the popup should be passed through this filter (function).
No Hooks.
Returns
String.
Usage
<?php popuplinks( $text ) ?>
- $text(string) (required)
- Text in which regular links should be replaced with links to open in a new window.
Examples
#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() popuplinks code WP 7.0
function popuplinks( $text ) {
_deprecated_function( __FUNCTION__, '4.5.0' );
$text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
return $text;
}