Trim Usernames


This WordPress plugin trims the usernames to eliminate accidentally entered ( usually during copy/paste) spaces, tabs, colons, and double quotation marks.

Why? – Because some hotheads out there will not memorize their own username but will attempt to co copy/paste it into your login page even though they have not been licensed to operate a computer mouse.

Seriously, there are real people who got shaky hands due to their old age, physical exertion, excessive use of recreational substances ( = too much coffee), or just the plain excitement of seeing your blog.

They would try to copy their username and then paste it into your login form, but would capture a few extra characters around the username, and WordPress will dutifully accept these extras, process them as a part of the username, and spit out “wrong password” error, confusing the hell out of the users and you. (they know they simply could not make a mistake, since all they did was copy the data)!

And then they will blame you.

Notice how the message “wrong password” is misleading. In my experience, most of “wrong password” problems in WordPress are caused by one of three mistakes:

  1. Ignoring WordPress insistance on paying attention to the capitalization of usernames – this can be solved with my Insensitive plug-in;
  2. Capturing extra characters when copying/pasting passwords – covered by my Trim Passwords plug-in;
  3. Capturing extra characters when copying/pasting usernames – resolved here by Trim Usernames plug-in.

What it does, how it works

All you have to do is install the plugin. There is nothing to configure.

Once installed, it will automatically trim spaces, colons, tabs, and double quotation marks at the beginning and the end of usernames at login.

If you have readers with existing usernames that start/end with the characters trimmed by this plugin, they will NOT be able to log in. Granted, such usernames are rather extravagant, so you are on your own then. Sorry.


I wrote “Trim Usernames” for my own purposes, not for public distribution. It is provided “As Is” and can probably do horrible harm.

I do not know PHP. I have never written a full PHP program in my life. Not even “Hello, World”. This means the code may be buggy and is guaranteed to be sub-optimal. Yes, this is my fifth WordPress plug-in, but it has been developed using the time honored Open Source model: “Monkey See – Monkey Do”. Do not expect me to understand why it works 😉

If it works fine for you, please leave a comment here – it will encourage me and other potential users. Oh, and if you can make it better – go for it!

Good luck!


Have you read the Disclaimer above??? – download Trim Usernames here: Trim Usernames plug-in for WordPress, Version 0.9


  1. Download the plugin (see “Download” above).
  2. Rename trim-usernames.txt to trim-usernames.php and put it into your plugins directory (wp-content/plugins/) or in a sub directory of the plugins directory.
  3. Activate the Plug-in.
  4. Enjoy!

Thank you

Writing all this up took time and effort. If you happen to be actually using this plug-in – I appreciate your vote of confidence and would love to hear about it!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


I am sorry you have to see this. Actually, I am not – if you came here, it’s you fault. When we choose our actions we also choose the consequences.

Despite my oversized ego I do NOT believe that anyone out there craves a daily dose of my insight. In fact, I am suspicious of people who think otherwise.

This blog is a tool.

I meddle with many complex computer deployments, and as I go through adding features and learning things, I also tend to forget numerous details and the reasoning behind the many choices I have made in the past. This is the place to document my adventures. And to give something back.

If you stumble upon this and find it useful – …good for you.

%d bloggers like this: