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

get_the_author_link()

检索作者的链接或作者的名称

author 作者more...

linkmore...

themore...


描述

如果作者设置了主页,则返回HTML链接,否则只返回作者的名称


返回

(string|null) 如果用户meta中存在作者的url,则返回HTML链接,否则为get_the_author()的结果。



源码

查看源码 官方文档


更新日志

版本描述
3.0.0开始引入

使用示例

  • 示例1

    本例将作者的网站URL显示为链接,链接的文本是作者的个人资料显示名称。在本例中,作者的显示名为James Smith。

    <p>Written by: 
    <?php echo get_the_author_link(); ?></p>
    

    显示为:

    Written by: James Smith