如何解决WordPress:get_the_author_meta在函数和挂钩中不起作用PHP
我正在使用带有钩子frm_to_email
和函数custom_set_email_value($recipients,$values,$form_id,$args)
的强大表单插件来自定义特定收件人的电子邮件。我正在使用函数get_the_author_Meta('user_email')
来获取作者的电子邮件并将其用作收件人,但是它不起作用。但是,如果我使用像“ user@user.com”这样的硬编码电子邮件字符串,则可以正常工作。有任何想法吗?下面的代码:
function custom_set_email_value($recipients,$args){
$recipients = array();
if ($form_id == 2 && $args['email_key'] == 6806) {
$recipients[] = 'test@test.com';
} else {
//not working
$recipients[] = get_the_author_Meta('user_email');
//working
//$recipients[] = 'user@user.com';
}
return $recipients;
}
add_filter('frm_to_email','custom_set_email_value',10,4);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。