Filter hook 'comment_email'

in WP Core File wp-includes/comment-template.php at line 203

View Source

comment_email

Filter Hook
Description
Filters the comment author's email for display. Care should be taken to protect the email address and assure that email harvesters do not capture your commenter's email address.

Hook Information

File Location wp-includes/comment-template.php View on GitHub
Hook Type Filter
Line Number 203

Hook Parameters

Type Name Description
string $comment_author_email The comment author's email address.
WP_Comment $comment The comment object.

Usage Examples

Basic Usage
<?php
// Hook into comment_email
add_filter('comment_email', 'my_custom_filter', 10, 2);

function my_custom_filter($comment_author_email, $comment) {
    // Your custom filtering logic here
    return $comment_author_email;
}

Source Code Context

wp-includes/comment-template.php:203 - How this hook is used in WordPress core
<?php
 198  	 * @since 4.1.0 The `$comment` parameter was added.
 199  	 *
 200  	 * @param string     $comment_author_email The comment author's email address.
 201  	 * @param WP_Comment $comment              The comment object.
 202  	 */
 203  	$comment_author_email = apply_filters( 'comment_email', $comment->comment_author_email, $comment );
 204  
 205  	if ( ( ! empty( $comment_author_email ) ) && ( '@' !== $comment_author_email ) ) {
 206  		$display = ( '' !== $link_text ) ? $link_text : $comment_author_email;
 207  
 208  		$comment_author_email_link = $before . sprintf(

PHP Documentation

<?php
/**
	 * Filters the comment author's email for display.
	 *
	 * Care should be taken to protect the email address and assure that email
	 * harvesters do not capture your commenter's email address.
	 *
	 * @since 1.2.0
	 * @since 4.1.0 The `$comment` parameter was added.
	 *
	 * @param string     $comment_author_email The comment author's email address.
	 * @param WP_Comment $comment              The comment object.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/comment-template.php
Related Hooks

Related hooks will be displayed here in future updates.