函数文档

get_the_author_email()

💡 云策文档标注

概述

get_the_author_email() 是一个已弃用的 WordPress 函数,用于获取当前文章作者的电子邮件地址。自 2.8.0 版本起,建议使用 get_the_author_meta('email') 替代。

关键要点

  • 函数功能:检索当前文章作者的电子邮件地址。
  • 弃用状态:自 WordPress 2.8.0 版本起被弃用,使用 _deprecated_function() 标记。
  • 替代方案:推荐使用 get_the_author_meta('email') 函数来获取相同数据。
  • 返回值:返回字符串类型的作者电子邮件地址。
  • 相关函数:get_the_author_meta() 用于检索作者元数据,_deprecated_function() 用于标记弃用函数。

代码示例

function get_the_author_email() {
    _deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta('email')' );
    return get_the_author_meta('email');
}

注意事项

  • 在开发新代码时,应避免使用此弃用函数,改用 get_the_author_meta('email') 以确保兼容性和最佳实践。
  • 如果使用此函数,WordPress 会通过 _deprecated_function() 发出弃用警告,提醒开发者更新代码。

📄 原文内容

Retrieve the email of the author of the current post.

Description

See also

Return

string The author’s username.

Source

function get_the_author_email() {
	_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta('email')' );
	return get_the_author_meta('email');
}

Changelog

Version Description
2.8.0 Deprecated. Use get_the_author_meta()
1.5.0 Introduced.