# _make_clickable_rel_attr()

URL: https://chugunov.pro/api-wordpress/functions/_make_clickable_rel_attr/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 6.2.0.

## Сигнатура

```php
_make_clickable_rel_attr( string $url ): string
```

## Описание

Вспомогательная функция для формирования атрибута «rel» для URL при создании ссылки с помощью make_clickable() .

## Параметры

- `$url` `string` — обязательный. URL.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-includes/formatting.php:3033`

```php
function _make_clickable_rel_attr( $url ) {
	$rel_parts        = array();
	$scheme           = strtolower( wp_parse_url( $url, PHP_URL_SCHEME ) );
	$nofollow_schemes = array_intersect( wp_allowed_protocols(), array( 'https', 'http' ) );

	// Apply "nofollow" to external links with qualifying URL schemes (mailto:, tel:, etc... shouldn't be followed).
	if ( ! wp_is_internal_link( $url ) && in_array( $scheme, $nofollow_schemes, true ) ) {
		$rel_parts[] = 'nofollow';
	}

	// Apply "ugc" when in comment context.
	if ( 'comment_text' === current_filter() ) {
		$rel_parts[] = 'ugc';
	}

	$rel = implode( ' ', $rel_parts );

	/**
	 * Filters the rel value that is added to URL matches converted to links.
	 *
	 * @since 5.3.0
	 *
	 * @param string $rel The rel value.
	 * @param string $url The matched URL being converted to a link tag.
	 */
	$rel = apply_filters( 'make_clickable_rel', $rel, $url );

	$rel_attr = $rel ? ' rel="' . esc_attr( $rel ) . '"' : '';

	return $rel_attr;
}
```

## История изменений

- 6.2.0 — Introduced.

## Связанные

Использует: [`wp_is_internal_link`](https://chugunov.pro/api-wordpress/functions/wp_is_internal_link/), [`wp_parse_url`](https://chugunov.pro/api-wordpress/functions/wp_parse_url/), [`wp_allowed_protocols`](https://chugunov.pro/api-wordpress/functions/wp_allowed_protocols/), [`current_filter`](https://chugunov.pro/api-wordpress/functions/current_filter/), [`esc_attr`](https://chugunov.pro/api-wordpress/functions/esc_attr/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`_make_url_clickable_cb`](https://chugunov.pro/api-wordpress/functions/_make_url_clickable_cb/), [`_make_web_ftp_clickable_cb`](https://chugunov.pro/api-wordpress/functions/_make_web_ftp_clickable_cb/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/_make_clickable_rel_attr/
