# wp_get_unapproved_comment_author_email()

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

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

## Сигнатура

```php
wp_get_unapproved_comment_author_email(): string
```

## Описание

Позволяет комментатору видеть свой комментарий, ожидающий одобрения.

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

`string`

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

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

```php
function wp_get_unapproved_comment_author_email() {
	$commenter_email = '';

	if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) {
		$comment_id = (int) $_GET['unapproved'];
		$comment    = get_comment( $comment_id );

		if ( $comment && hash_equals( $_GET['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) {
			// The comment will only be viewable by the comment author for 10 minutes.
			$comment_preview_expires = strtotime( $comment->comment_date_gmt . '+10 minutes' );

			if ( time() < $comment_preview_expires ) {
				$commenter_email = $comment->comment_author_email;
			}
		}
	}

	if ( ! $commenter_email ) {
		$commenter       = wp_get_current_commenter();
		$commenter_email = $commenter['comment_author_email'];
	}

	return $commenter_email;
}
```

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

- 5.7.0 — The window within which the author email for an unapproved comment can be retrieved was extended to 10 minutes.
- 5.1.0 — Introduced.

## Связанные

Использует: [`wp_hash`](https://chugunov.pro/api-wordpress/functions/wp_hash/), [`wp_get_current_commenter`](https://chugunov.pro/api-wordpress/functions/wp_get_current_commenter/), [`get_comment`](https://chugunov.pro/api-wordpress/functions/get_comment/).
Используется в: [`build_comment_query_vars_from_block`](https://chugunov.pro/api-wordpress/functions/build_comment_query_vars_from_block/), [`wp_list_comments`](https://chugunov.pro/api-wordpress/functions/wp_list_comments/), [`comments_template`](https://chugunov.pro/api-wordpress/functions/comments_template/), [`get_page_of_comment`](https://chugunov.pro/api-wordpress/functions/get_page_of_comment/).

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