wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_rel_ugc › WordPress Function

Since5.3.0
Deprecatedn/a
wp_rel_ugc ( $text )
Parameters:
  • (string) $text Content that may contain HTML A elements.
    Required: Yes
Returns:
  • (string) Converted content.
Defined at:
Codex:

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



Source

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',
		static function ( $matches ) {
			return wp_rel_callback( $matches, 'nofollow ugc' );
		},
		$text
	);
	return wp_slash( $text );
}