the_author_ID()
云策文档标注
概述
the_author_ID() 是一个已弃用的 WordPress 模板标签,用于显示当前文章作者的 ID。自 2.8.0 版本起,建议使用 the_author_meta('ID') 替代。
关键要点
- the_author_ID() 已被弃用,不应在新代码中使用。
- 替代方案是使用 the_author_meta('ID') 来获取作者 ID。
- 此函数在 wp-includes/author-template.php 中定义,并调用 _deprecated_function() 标记弃用。
注意事项
使用 the_author_ID() 会触发弃用警告,建议更新代码以避免兼容性问题。
原文内容
Display the ID of the author of the current post.
Description
See also
Source
function the_author_ID() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta('ID')' );
the_author_meta('ID');
}
Changelog
| Version | Description |
|---|---|
| 2.8.0 | Deprecated. Use the_author_meta() |
| 0.71 | Introduced. |