Viewing 2 replies - 1 through 2 (of 2 total)
  • missveronica

    (@missveronicatv)

    @ziemowit1

    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

    https://www.ads-software.com/plugins/code-snippets/

    Thread Starter ziemowit1

    (@ziemowit1)

    Nothing more to add, it just works.

    Thank You @missveronicatv.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.