Wordpress:get_the_author_meta未在函数和钩子(PHP)中工作

Wordpress:get_the_author_meta未在函数和钩子(PHP)中工作,php,wordpress,function,hook,formidable,Php,Wordpress,Function,Hook,Formidable,我正在使用强大的表单插件,带有hookfrm\u to\u email和函数custom\u set\u email\u value($recipients,$values,$form\u id,$args)来定制特定收件人的电子邮件。我正在使用函数获取作者元数据(“用户电子邮件”)获取作者电子邮件并将其用作收件人,但它不起作用。但是,如果我使用硬编码的电子邮件字符串,如'user@user.com“它起作用了。有什么想法吗?代码如下: function custom_set_email_val

我正在使用强大的表单插件,带有hook
frm\u to\u email
和函数
custom\u set\u email\u value($recipients,$values,$form\u id,$args)
来定制特定收件人的电子邮件。我正在使用函数
获取作者元数据(“用户电子邮件”)
获取作者电子邮件并将其用作收件人,但它不起作用。但是,如果我使用硬编码的电子邮件字符串,如'user@user.com“它起作用了。有什么想法吗?代码如下:

function custom_set_email_value($recipients, $values, $form_id, $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);
代码放在子主题的functions.php文件中