get_comment_author_email()WP 1.5.0

Получает email автора текущего в цикле комментария. Можно указать ID комментария, email автора которого нужно получить.

Основа для: comment_author_email()
1 раз — 0.00031 сек (быстро) | 50000 раз — 0.57 сек (очень быстро)
Хуки из функции

Возвращает

Строку. email комментатора.

Использование

get_comment_author_email( $comment_ID );
$comment_ID(число/объект)
ID или объект комментария, email автора которого нужно получить.
По умолчанию: 0 - текущий в цикле комментарий

Примеры

0

#1 Получим email комментатора

У нас есть комментария с ID 2020, нам нужно получить email автора этого комментария:

echo get_comment_author_email( 2020 ); // > evgeniy@gmail.com

Список изменений

С версии 1.5.0 Введена.
С версии 4.4.0 Added the ability for $comment_id to also accept a WP_Comment object.

Код get_comment_author_email() WP 6.5.2

function get_comment_author_email( $comment_id = 0 ) {
	$comment = get_comment( $comment_id );

	/**
	 * Filters the comment author's returned email address.
	 *
	 * @since 1.5.0
	 * @since 4.1.0 The `$comment_id` and `$comment` parameters were added.
	 *
	 * @param string     $comment_author_email The comment author's email address.
	 * @param string     $comment_id           The comment ID as a numeric string.
	 * @param WP_Comment $comment              The comment object.
	 */
	return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
}