WordPress:get_the_author_meta在函数和挂钩中不起作用PHP

问题描述

我正在使用带有钩子frm_to_email函数custom_set_email_value($recipients,$values,$form_id,$args)的强大表单插件自定义特定收件人的电子邮件。我正在使用函数get_the_author_Meta('user_email')获取作者的电子邮件并将其用作收件人,但是它不起作用。但是,如果我使用像“ [email protected]”这样的硬编码电子邮件字符串,则可以正常工作。有任何想法吗?下面的代码

function custom_set_email_value($recipients,$args){
    
     $recipients = array();

     if ($form_id == 2 && $args['email_key'] == 6806) {
          $recipients[] = '[email protected]';
     } else {
          //not working
          $recipients[] = get_the_author_Meta('user_email');

          //working
          //$recipients[] = '[email protected]';
     }      
     return $recipients;
}


add_filter('frm_to_email','custom_set_email_value',10,4);

代码以子主题的形式放置在functions.PHP文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)