How Allow Email Provider for registration your site


Hello Everybody how are you? today i will teach you how to allow email provider for registration in your website. it’s easy work. we know, lot of spammer everyday spamming in WordPress site  and spamming register using lot of one time visuals email  provider, so if you want to off another spamming email servers then you can follow this tips, just open your current active folder and find functions.php file, then open this file any editor software, like: notepad++ then just input below codes in your functions.php page, must be input this code at last ?> code before, example: you can see your file at last code ?> sign, then you will input your code is this sing before.

so just copy below code then you will past in your functions.php page then save you page, now it’s working..

Allow Email Provider for registraion this site

function mh_check_email_provider($errors, $sanitized_user_login, $user_email){

// Allowed Email provider. Must include extention
$allowed_provider = array('', '', '', '', '');

// Get users email provider
$user_mail_provider = substr($user_email, strpos($user_email, '@')+1);
// Check if users email provider is allowed
if(in_array($user_mail_provider, $allowed_provider)){
// Allowed provider:)
// Return unchanged $erorrs
return $errors;
// Provider not allowed :(
// Add error code and return
$errors->add( 'restricted_emial_provider', __( '<strong>ERROR</strong>: We only support ' . implode(', ', $allowed_provider) ) );
return $errors;
// That's it
add_filter('registration_errors', 'mh_check_email_provider', 100, 3);

You can this one line in above codes

// Allowed Email provider. Must include extention
$allowed_provider = array('', '', '', '', '');

You can see email provider name, examples:, etc…

Now if you want then you can add more email providers or remove any email providers,

if you want to add any email providers? then just input comma and double cotation, examples: if you want to input then just input ‘’, ‘’, ‘’, ‘’, ‘’, ‘hotmail’ and at first use comma.


Thanks for read this article, if you need any help then you can comments below box. thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!