diff --git a/class-two-factor-core.php b/class-two-factor-core.php index 8086c434..77f28b05 100644 --- a/class-two-factor-core.php +++ b/class-two-factor-core.php @@ -673,7 +673,7 @@ public static function get_primary_provider_for_user( $user = null ) { $provider = self::get_primary_provider_key_selected_for_user( $user ); // If the provider specified isn't enabled, just grab the first one that is. - if ( ! isset( $available_providers[ $provider ] ) ) { + if ( empty( $provider ) || ! isset( $available_providers[ $provider ] ) ) { $provider = key( $available_providers ); } }