[ad_1]
You can try this code snippet
add_action( 'um_submit_form_errors_hook_login', 'custom_submit_form_errors_hook_login', 10, 1 );
function custom_submit_form_errors_hook_login( $args ) {
if ( isset( $args['username'] ) && ! empty( $args['username'] )) {
$login_type = 'login';
if ( is_email( $args['username'] )) {
$login_type = 'email';
}
$user = get_user_by( $login_type, $args['username'] );
if ( in_array( 'administrator', $user->roles )) {
UM()->logout();
exit( wp_redirect( home_url() ) );
}
}
}
Install by adding the code snippet to your active theme’s functions.php
file
or use the “Code Snippets” Plugin
Nothing more to add, it just works.
Thank You @missveronicatv.