get_the_author_description()
云策文档标注
概述
get_the_author_description() 是一个已弃用的 WordPress 函数,用于获取当前文章作者的描述。自 2.8.0 版本起,建议使用 get_the_author_meta('description') 替代。
关键要点
- 函数功能:检索当前文章作者的描述信息。
- 弃用状态:自 WordPress 2.8.0 版本起被弃用,应改用 get_the_author_meta('description')。
- 返回值:返回作者描述的字符串。
- 相关函数:与 get_the_author_meta() 和 _deprecated_function() 关联。
代码示例
function get_the_author_description() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta('description')' );
return get_the_author_meta('description');
}注意事项
- 在开发新代码时,避免使用此函数,以遵循 WordPress 最佳实践并确保兼容性。
- 如果维护旧代码,应考虑迁移到 get_the_author_meta('description') 以消除弃用警告。
原文内容
Retrieve the description of the author of the current post.
Description
See also
Source
function get_the_author_description() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta('description')' );
return get_the_author_meta('description');
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Deprecated. Use get_the_author_meta() |
| 1.5.0 | Introduced. |