the_author_email()
云策文档标注
概述
the_author_email() 是一个已弃用的 WordPress 函数,用于显示当前文章作者的电子邮件地址。自 2.8.0 版本起,建议使用 the_author_meta('email') 替代。
关键要点
- the_author_email() 函数已被弃用,不应在新代码中使用。
- 替代函数是 the_author_meta('email'),它输出用户数据库对象中的字段,默认为当前文章作者。
- 弃用信息通过 _deprecated_function() 标记,使用时会通知开发者。
- 函数最初在 0.71 版本引入,于 2.8.0 版本弃用。
代码示例
function the_author_email() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta('email')' );
the_author_meta('email');
}注意事项
- 在开发新功能或维护旧代码时,应优先使用 the_author_meta('email') 以避免兼容性问题。
- 弃用函数可能在未来版本中被移除,建议及时更新代码。
原文内容
Display the email of the author of the current post.
Description
See also
Source
function the_author_email() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta('email')' );
the_author_meta('email');
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Deprecated. Use the_author_meta() |
| 0.71 | Introduced. |