diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index c2a975d896456..58527b19a6685 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -595,7 +595,9 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() */ function wp_authenticate( $username, $password ) { $username = sanitize_user( $username ); - $password = trim( $password ); + if ( is_string( $password ) && '' !== $password ) { + $password = trim( $password ); + } /** * Filters whether a set of user login credentials are valid.