summaryrefslogtreecommitdiffstats
path: root/wp-includes/formatting.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/formatting.php')
-rw-r--r--wp-includes/formatting.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php
index e2b969a..eeafe0b 100644
--- a/wp-includes/formatting.php
+++ b/wp-includes/formatting.php
@@ -332,6 +332,9 @@ function sanitize_user( $username, $strict = false ) {
if ( $strict )
$username = preg_replace('|[^a-z0-9 _.\-@]|i', '', $username);
+ // Consolidate contiguous whitespace
+ $username = preg_replace('|\s+|', ' ', $username);
+
return apply_filters('sanitize_user', $username, $raw_username, $strict);
}