Home Forums ACF PRO Exclude .ru email


Exclude .ru email

  • Hello,

    I’ve many spam on my forum so i want exclude all email .ru

    I’ve added on my function.php, this code :

    function my_acf_validate_email( $valid, $value, $field, $input ){
    	if( !$valid ) {
    		return $valid;
    	$email = explode($_POST["acf"]["field_5775908e70ce0"], "@");
    	if(preg_match("/(.*).ru$/", $email) || preg_match("/(.*)$/", $email)){
    		$valid = __("error", "monsite");	
    		$valid = __("error.", "monsite");
    	return $valid;

    But it’s not working.
    Any idea ?

    Thanks for your help

  • Hi @triixx

    It seems the way you were using the explode() function is not correct. Instead of like this:

    $email = explode($_POST["acf"]["field_5775908e70ce0"], "@");

    It should be like this:

    $email = explode("@", $value);

    Because this issue is more related to PHP, kindly visit PHP community instead for further support.

    I hope this helps 🙂

  • Thanks, it’s ok !
    Sorry ^^

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Exclude .ru email’ is closed to new replies.