3

I need to know what the wp specifications for the usernames are. Like allowed minimum and maximum length, are special characters like ü,ö,ä,ß accepted,..?

Unfortunately I couldn't find any insight on this in the interweb. Do you have any?

5

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.

  • thank you! But I think the minimum is 4, at least according to this related question: wordpress.stackexchange.com/questions/59760/… – Sebsemillia May 14 '13 at 22:01
  • 1
    I tested on a dev install and was able to register a user named "y". – s_ha_dum May 14 '13 at 22:04
  • Yeah you are right, I just tested it myself. Strange thing.. – Sebsemillia May 14 '13 at 22:12
  • The other question is about multisite. There may be a minimum with that. – s_ha_dum May 15 '13 at 3:59
  • In 2016 I still confirm what @s_ha_dum said: everyone can use an username formed by only 1 character. – Marco Panichi Apr 7 '16 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.