Support

Account

Home Forums Front-end Issues Don't update email if it exists. Show error on same page in Reply To: Don't update email if it exists. Show error on same page in

  • I figured it out:

    function my_acf_validate_value( $valid, $value, $field, $input ) {
    	
    	$current_id = get_current_user_id();
    	$wp_user_id = 'user_' . $current_id;
    	$current_email = get_the_author_meta('user_email', $current_id);
    			
    	if($value == "" || $value == " ") {
    		$valid = "Email field cannot be empty";
    	} elseif( email_exists($value) && $value != $current_email ) {
    		$valid = "This email already exists. Use a unique email";
    	}
    	return $valid;
    	
    }

    I figured this out. I’d like this validation to only be on the front end of the site not in the admin area. I’ll start another forum thread for that.