WordPress User Name Limitations

I think the answer is in the source.

$username = wp_strip_all_tags( $username );
$username = remove_accents( $username );
// Kill octets
$username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
$username = preg_replace( '/&.+?;/', '', $username ); // Kill entities

// If strict, reduce to ASCII for max portability.
if ( $strict )
     $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );

So, the code strips tags, octets, and html entities. And it replaces accented characters with unaccented ones via the remove_accents function, which is fairly lengthy. Other characters get through unless $strict is true (default is false), in which case only ASCII characters are allowed.

The maximum login name length would be the database limit for the user_login column— 60 characters. The minimum, as best I can tell, is 1.

Leave a Comment