|
wordpress4.1新增了一个钩子:author_email,可以利用这个filter显示自定义评论作者的email。形式如下:
</div><p>apply_filters ( ‘author_email’, string $author_email, int $comment_ID )</p>
<p><br />
在wp-<a href="/tags.php/include/" target="_blank">include</a>s/comment-template.php的comment_author_email函数中用到了author_email的filter。</p>
<p>function comment_author_email( $comment_ID = 0 ) {<br />
$author_email = get_comment_author_email( $comment_ID );<br />
<br />
/**<br />
* Filter the comment author's email for display.<br />
*<br />
* @since 1.2.0<br />
* @since 4.1.0 The `$comment_ID` parameter was added.<br />
*<br />
* @param string $author_email The comment author's email address.<br />
* @param int $comment_ID The comment ID.<br />
*/<br />
echo apply_filters( 'author_email', $author_email, $comment_ID );<br />
} |
|