Support » Fixing WordPress » Deny usernames with SPACE character when registering

  • Hi,

    I’m integrating my wordpress login with a mIRC client.

    Since IRC does not support space characters or any other special characters at names, I would like to know:

    How to prevent user to create accounts with spaces and special characters in their usernames?

    Best regards.

    Filipe Deschamps

Viewing 5 replies - 1 through 5 (of 5 total)
  • Aw guys, no idea? 🙂


    I am just guessing here, so please use caution:

    In wp-includes/formatting.php is a function sanitize_user() — perhaps that’s the place you should start looking. That the file is named formatting.php gives me pause… perhaps the class WP_User is where you should add your code. If you are not PHP proficient, you can ping me, and I can try to figure out the exact spot to add relevant code.

    Also, have you checked to see if a plug-in already exists that implements this?


    Unfortunately, there’s no plugins to prevent space character in usernames.

    I have some knowledge with php, but I’m to scared to mess up with core files due to upgrading problems.

    I still couldn’t find a solution for this.

    In the Plugin API/Filter Reference, you will find a brief mention of pre_user_login that is applied to a user login before saving in the DB. Perhaps you can use that to screen out special characters.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Deny usernames with SPACE character when registering’ is closed to new replies.