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



wp_rel_ugc ›

Since5.3.0
已弃用n/a
wp_rel_ugc ( $text )
参数:
  • (string) $text Content that may contain HTML A elements.
    Required: Yes
返回:
  • (string) Converted content.
定义在:
文档:

Adds `rel="nofollow ugc"` string to all HTML A elements in content.



源码

function wp_rel_ugc( $text ) {
	// This is a pre-save filter, so text is already escaped.
	$text = stripslashes( $text );
	$text = preg_replace_callback(
		'|<a (.+?)>|i',
		function( $matches ) {
			return wp_rel_callback( $matches, 'nofollow ugc' );
		},
		$text
	);
	return wp_slash( $text );
}