the_author_lastname()
云策文档标注
概述
the_author_lastname() 是一个已弃用的 WordPress 模板标签,用于显示当前文章作者的名字。自 2.8.0 版本起,建议使用 the_author_meta('last_name') 替代。
关键要点
- 该函数用于输出当前文章作者的姓氏。
- 自 WordPress 2.8.0 版本起被弃用,推荐使用 the_author_meta('last_name') 作为替代。
- 函数内部调用 _deprecated_function() 标记为弃用,并自动重定向到 the_author_meta('last_name')。
- 相关函数包括 the_author_meta() 和 _deprecated_function()。
代码示例
function the_author_lastname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta('last_name')' );
the_author_meta('last_name');
}注意事项
- 在开发新主题或插件时,应避免使用此弃用函数,改用 the_author_meta('last_name') 以确保兼容性。
- 弃用信息会在调试模式下显示,帮助开发者识别和更新代码。
原文内容
Display the last name of the author of the current post.
Description
See also
Source
function the_author_lastname() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta('last_name')' );
the_author_meta('last_name');
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Deprecated. Use the_author_meta() |
| 0.71 | Introduced. |