以联系方式验证

时间:2016-09-30 09:56:08

标签: wordpress validation contact-form-7

如何以联系表格7添加条件 如何写入条件在wordpress联系表格7中输入电子邮件ID或电话号码

function custom_validation_filter($result, $tag) {  
      $type = $tag['type'];  
      $email = $tag['email-603'];  
      $phone = $tag['tel-254'];  
      if($email == '' || $phone == '') { 
           
                $result['valid'] = false;  
                $result['reason'][$email] = 'Please enter email or phone number';  
             
      };  
       return $result;  
 };  
 add_filter('wpcf7_validate_text','custom_validation_filter', 10, 2);

0 个答案:

没有答案