# wp_get_current_commenter()

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

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

## Сигнатура

```php
wp_get_current_commenter(): array
```

## Описание

Предполагается, что содержимое cookie уже очищено. Тот, кто использует эту функцию, может пожелать повторно проверить возвращаемый массив на корректность.
См. alsosanitize_comment_cookies(): используется для очистки cookie

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

`array` — comment_author stringИмя текущего комментатора или пустая строка. comment_author_email stringАдрес электронной почты текущего комментатора или пустая строка. comment_author_url stringURL-адрес текущего комментатора или пустая строка.

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

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

```php
function wp_get_current_commenter() {
	// Cookies should already be sanitized.

	$comment_author = '';
	if ( isset( $_COOKIE[ 'comment_author_' . COOKIEHASH ] ) ) {
		$comment_author = $_COOKIE[ 'comment_author_' . COOKIEHASH ];
	}

	$comment_author_email = '';
	if ( isset( $_COOKIE[ 'comment_author_email_' . COOKIEHASH ] ) ) {
		$comment_author_email = $_COOKIE[ 'comment_author_email_' . COOKIEHASH ];
	}

	$comment_author_url = '';
	if ( isset( $_COOKIE[ 'comment_author_url_' . COOKIEHASH ] ) ) {
		$comment_author_url = $_COOKIE[ 'comment_author_url_' . COOKIEHASH ];
	}

	/**
	 * Filters the current commenter's name, email, and URL.
	 *
	 * @since 3.1.0
	 *
	 * @param array $comment_author_data {
	 *     An array of current commenter variables.
	 *
	 *     @type string $comment_author       The name of the current commenter, or an empty string.
	 *     @type string $comment_author_email The email address of the current commenter, or an empty string.
	 *     @type string $comment_author_url   The URL address of the current commenter, or an empty string.
	 * }
	 */
	return apply_filters( 'wp_get_current_commenter', compact( 'comment_author', 'comment_author_email', 'comment_author_url' ) );
}
```

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

- 2.0.4 — Introduced.

## Связанные

Использует: [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `Walker_Comment::filter_comment_text`, [`wp_get_unapproved_comment_author_email`](https://chugunov.pro/api-wordpress/functions/wp_get_unapproved_comment_author_email/), `Walker_Comment::comment`, `Walker_Comment::html5_comment`, [`comment_form`](https://chugunov.pro/api-wordpress/functions/comment_form/), [`comments_template`](https://chugunov.pro/api-wordpress/functions/comments_template/).

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