Callback to add a target attribute to all links in passed content.
Parameters
$mstringrequired- The matched link.
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 ) . '">';
}
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.