搜索
Hi~登录注册
查看: 1632|回复: 0

AUTHOR_EMAIL FILTER自定义评论作者的EMAIL

[复制链接]

1892

主题

1899

帖子

6406

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
6406
发表于 2015-5-14 13:47:46 | 显示全部楼层 |阅读模式
wordpress4.1新增了一个钩子:author_email,可以利用这个filter显示自定义评论作者的email。形式如下:
</div><p>apply_filters ( &lsquo;author_email&rsquo;, 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 />
&nbsp;&nbsp;&nbsp; $author_email = get_comment_author_email( $comment_ID );<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp;&nbsp; * Filter the comment author's email for display.<br />
&nbsp;&nbsp;&nbsp;&nbsp; *<br />
&nbsp;&nbsp;&nbsp;&nbsp; * @since 1.2.0<br />
&nbsp;&nbsp;&nbsp;&nbsp; * @since 4.1.0 The `$comment_ID` parameter was added.<br />
&nbsp;&nbsp;&nbsp;&nbsp; *<br />
&nbsp;&nbsp;&nbsp;&nbsp; * @param string $author_email The comment author's email address.<br />
&nbsp;&nbsp;&nbsp;&nbsp; * @param int&nbsp;&nbsp;&nbsp; $comment_ID&nbsp;&nbsp; The comment ID.<br />
&nbsp;&nbsp;&nbsp;&nbsp; */<br />
&nbsp;&nbsp;&nbsp; echo apply_filters( 'author_email', $author_email, $comment_ID );<br />
}
公众微信:idc5ahl
公众QQ:吾爱互联
关注公众微信,公众QQ每天领现金卡密
卡密介绍(http://www.5ahl.com/thread-2182-1-1.html
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 点我注册

快速回复 返回顶部 返回列表