Created
July 22, 2020 18:22
-
-
Save taricco/8ab7a450a34a67a887b4a2eb9da29acd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* https://wordpress.org/plugins/user-registration/ */ | |
| function ur_validate_user_email( $single_form_field, $data, $filter_hook, $form_id ) { | |
| $value = isset( $data->value ) ? $data->value : ''; | |
| $blacklist = array( 'gmail.com', 'hotmail.com', 'outlook.com', 'aol.com', 'mail.com', 'yahoo.com', 'icloud.com' ); | |
| $parts = explode( '@', $value ); | |
| if( in_array( $parts[1], $blacklist ) ) { | |
| add_filter( $filter_hook, function ( $msg ) use ( $field_label ) { | |
| return __( 'You must use a business email address. Email addresses like @gmail.com and @outlook.com are not accepted.', 'user-registration' ); | |
| }); | |
| } | |
| } | |
| add_action( 'user_registration_validate_user_email','ur_validate_user_email', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment