wordpress建站中,如何利用自身函数显示当前评论的作者email,下面小编给大家简单介绍一下comment_author_email
函数的基本用法!
函数原型:
comment_author_email( int|WP_Comment $comment_id )
函数源码:
function comment_author_email( $comment_id = 0 ) {
$comment = get_comment( $comment_id );
$author_email = get_comment_author_email( $comment );
echo apply_filters( 'author_email', $author_email, $comment->comment_ID );
}
调用方法:
<a href="mailto:<?php comment_author_email(); ?>">
<?php printf( __( 'Contact %s', 'textdomain' ), get_comment_author() ); ?>
</a>