Blacklist email domains from your WPForms not working now
-
These functions are not working now.
/*
* Blacklist email domains from your WPForms.
*
*
* @param int $field_id Field ID.
* @param array $field_submit Unsanitized field value submitted for the field.
* @param array $form_data Form data and settings.
*/function wpf_dev_blacklist_domains( $field_id, $field_submit, $form_data ) {
$domain = substr( strrchr( $field_submit, “@” ), 1 );
$blacklist = array( ‘gmail.com’, ‘yahoo.com’, ‘hotmail.com’ );if( in_array( $domain, $blacklist ) ) {
wpforms()->process->errors[ $form_data[‘id’] ][ $field_id ] = esc_html__( ‘Email domain not accepted!’, ‘wpforms’ );
return;
}
}add_action(‘wpforms_process_validate_email’, ‘wpf_dev_blacklist_domains’, 10, 3 );
- The topic ‘Blacklist email domains from your WPForms not working now’ is closed to new replies.