wp_rel_ugc()WP 5.3.0

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

Хуков нет.


Строку. Converted content.


wp_rel_ugc( $text );
$text(строка) (обязательный)
Content that may contain HTML A elements.

Список изменений

С версии 5.3.0 Введена.

Код wp_rel_ugc() WP 6.3.1

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' );
	return wp_slash( $text );