UM- Email Validation | WordPress.org

[ad_1]

I wrote following code to only allow new registrations from domain1.com email. Now i wish to allow new registrations from two domains domain1.com and domain2.com emails. How can i achieve this?

add_action('um_submit_form_errors_hook_','um_custom_validate_username', 999, 1);
function um_custom_validate_username( $args ) {
	
	if ( strpos( $args['user_email'], 'domain1.com') === false) {
		UM()->form()->add_error( 'user_email', 'Only official email address is allowed.' );
	}
}

Thanks

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer