links_add_target
函数
links_add_target ( $content, $target = '_blank', $tags = array('a') )
- 参数
-
-
(string)
$content
String to search for links in.- Required: 是
-
(string)
$target
The Target to add to the links.- Required: 否
- Default: ‘_blank’
-
(string[])
$tags
An array of tags to apply to.- Required: 否
- Default: array(‘a’)
-
(string)
- 返回值
-
- (string) The processed content.
- 定义位置
-
-
wp-includes/formatting.php
, line 5341
-
wp-includes/formatting.php
- 引入
- 2.7.0
- 弃用
- –
Adds a Target attribute to all links in passed content.
This function by default only applies to “ tags, however this can be
modified by the 3rd param.
*NOTE:* Any current target attributed will be stripped and replaced.
function links_add_target( $content, $target = '_blank', $tags = array( 'a' ) ) { global $_links_add_target; $_links_add_target = $target; $tags = implode( '|', (array) $tags ); return preg_replace_callback( "!]*)?)>!i", '_links_add_target', $content ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。