当前浏览:首页 / WordPress函数 / comment_author_url()

comment_author_url( int|WP_Comment $comment_ID )

显示当前评论作者的URL,未链接

author 作者more...

comment 评论more...

urlmore...


参数

$comment_ID

(int|WP_Comment)(可选) WP_Comment或要打印作者URL的评论的ID。默认当前评论。



源码

查看源码 官方文档


更新日志

版本描述
4.4.0增加了$comment_ID也能接受WP_Comment对象的能力。
0.71开始引入

使用示例

  • 示例1

    从Codex迁移的示例:

    将评论作者的URL显示为链接,并将评论作者的姓名作为链接文本的一部分。

    <a href="<?php comment_author_url(); ?>">Visit  <?php comment_author(); ?>'s site</a>
  • 示例2

    这段代码检查评论作者是否有url。

    if ( get_comment_author() == get_comment_author_link() ) {
    	// do something
    }