wordpress-website-lifecycle/mu-plugins/_core-username.php
2026-07-16 05:02:22 +02:00

18 lines
347 B
PHP

<?php
/*
* Plugin Name: Prevent space in username
* Plugin URI: https://core.trac.wordpress.org/ticket/44690
*/
add_filter(
'sanitize_user',
static function($username, $raw_username, $strict) {
if ($strict) {
return preg_replace('/\s+/', '', $username);
}
return $username;
},
10,
3
);