# edit_comment_link()

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

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

## Сигнатура

```php
edit_comment_link( string $text = null, string $before = '', string $after = '' )
```

## Описание

Выводит ссылку для редактирования комментария с форматированием.

## Параметры

- `$text` `string` — необязательный, по умолчанию `null`. Текст ссылки. Если null, по умолчанию ‘Edit This’.
- `$before` `string` — необязательный, по умолчанию `''`. Выводится перед ссылкой редактирования.
- `$after` `string` — необязательный, по умолчанию `''`. Выводится после ссылки редактирования.

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

Файл: `wp-includes/link-template.php:1645`

```php
function edit_comment_link( $text = null, $before = '', $after = '' ) {
	$comment = get_comment();

	if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
		return;
	}

	if ( null === $text ) {
		$text = __( 'Edit This' );
	}

	$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';

	/**
	 * Filters the comment edit link anchor tag.
	 *
	 * @since 2.3.0
	 *
	 * @param string $link       Anchor tag for the edit link.
	 * @param string $comment_id Comment ID as a numeric string.
	 * @param string $text       Anchor text.
	 */
	echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
}
```

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

- 1.0.0 — Introduced.

## Связанные

Использует: [`get_edit_comment_link`](https://chugunov.pro/api-wordpress/functions/get_edit_comment_link/), [`current_user_can`](https://chugunov.pro/api-wordpress/functions/current_user_can/), [`__`](https://chugunov.pro/api-wordpress/functions/__/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_comment`](https://chugunov.pro/api-wordpress/functions/get_comment/).
Используется в: `Walker_Comment::comment`, `Walker_Comment::html5_comment`, `Walker_Comment::ping`.

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