comment_author_email()
Выводит на экран email автора комментария.
Работает на основе: get_comment_author_email()
Хуки из функции
Возвращает
null
.
Использование
<?php comment_author_email( $comment_ID ); ?>
- $comment_ID(число/объект)
- ID или объект комментария, email автора которого нужно вывести на экран.
По умолчанию: текущий комментарий
Примеры
#1 Выведем на экран email комментатора:
<a href="mailto:<?php comment_author_email(); ?>">contact <?php comment_author(); ?></a>
Заметка: выводить адреса не рекомендуется, так как спамеры могут собирать их.
Список изменений
С версии 0.71 | Введена. |
С версии 4.4.0 | Added the ability for $comment_id to also accept a WP_Comment object. |
Код comment_author_email() comment author email WP 6.4.3
function comment_author_email( $comment_id = 0 ) { $comment = get_comment( $comment_id ); $comment_author_email = get_comment_author_email( $comment ); /** * Filters the comment author's email for display. * * @since 1.2.0 * @since 4.1.0 The `$comment_id` parameter was added. * * @param string $comment_author_email The comment author's email address. * @param string $comment_id The comment ID as a numeric string. */ echo apply_filters( 'author_email', $comment_author_email, $comment->comment_ID ); }