wpseek.com
WordPress开发者和主题制作者的搜索引擎



_links_add_target › WordPress Function

Since2.7.0
已弃用n/a
_links_add_target ( $m )
访问:
  • private
参数:
  • (string) $m The matched link.
    Required: Yes
返回:
  • (string) The processed link.
定义在:
文档:

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



源码

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