# get_comment_author_url_link()

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

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

## Сигнатура

```php
get_comment_author_url_link( string $link_text = '', string $before = '', string $after = '', int|WP_Comment $comment ): string
```

## Описание

Параметр $link_text используется только в том случае, если у автора комментария нет URL. Если URL существует, то будет использован URL, а $link_text будет проигнорирован.
HTML-ссылка заключается между $before и $after. Таким образом, она будет отображаться в порядке: $before, ссылка и, наконец, $after.

## Параметры

- `$link_text` `string` — необязательный, по умолчанию `''`. Текст для отображения вместо адреса электронной почты автора комментария.
- `$before` `string` — необязательный, по умолчанию `''`. Текст или HTML для отображения перед ссылкой электронной почты.
- `$after` `string` — необязательный, по умолчанию `''`. Текст или HTML для вывода после ссылки на электронную почту.
- `$comment` `int|WP_Comment` — необязательный. ID комментария или объект WP_Comment.
  
  По умолчанию — текущий комментарий.

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

`string`

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

Файл: `wp-includes/comment-template.php:433`

```php
function get_comment_author_url_link( $link_text = '', $before = '', $after = '', $comment = 0 ) {
	$comment_author_url = get_comment_author_url( $comment );

	$display = ( '' !== $link_text ) ? $link_text : $comment_author_url;
	$display = str_replace( 'http://www.', '', $display );
	$display = str_replace( 'http://', '', $display );

	if ( str_ends_with( $display, '/' ) ) {
		$display = substr( $display, 0, -1 );
	}

	$comment_author_url_link = $before . sprintf(
		'<a href="%1$s" rel="external">%2$s</a>',
		$comment_author_url,
		$display
	) . $after;

	/**
	 * Filters the comment author's returned URL link.
	 *
	 * @since 1.5.0
	 *
	 * @param string $comment_author_url_link The HTML-formatted comment author URL link.
	 */
	return apply_filters( 'get_comment_author_url_link', $comment_author_url_link );
}
```

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

- 4.6.0 — Added the $comment parameter.
- 1.5.0 — Introduced.

## Связанные

Использует: [`get_comment_author_url`](https://chugunov.pro/api-wordpress/functions/get_comment_author_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`comment_author_url_link`](https://chugunov.pro/api-wordpress/functions/comment_author_url_link/).

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