roles ) && is_array( $user->roles ) ) { // Retrieve the custom client redirect URL from settings, rigorously sanitized. $options = get_option( 'tt24_login_security_settings', array() ); $client_redirect = ! empty( $options['client_redirect_url'] ) ? esc_url_raw( $options['client_redirect_url'] ) : home_url(); // Check if the user is an Administrator if ( in_array( 'administrator', $user->roles, true ) ) { // Allow administrators access to the backend dashboard return admin_url(); } else { // Lock subscribers/clients out of the backend and send them to the designated portal return $client_redirect; } } // Fallback to default behavior if user authentication fails return $redirect_to; } }