Support » Fixing WordPress » Apostrophe in user name

  • Resolved tedinoz


    I’ve got several users with an apostrophe in their name (e.g., O’Brien)-but in every case their login name is 100% numeric.

    The apostrophe is inserting an error message in posts of apostrophised users – “right syntax to use near ‘Connell, John” at line 1]
    SELECT * FROM wp_users WHERE user_login = ‘O’Connell, John'”. Here is an example url :

    I can see it is have trouble parsing the nickname, but that is NOT the user_login and the error appears when the content is printed.

    Any suggestions/solutions about fixing this cheering received.


Viewing 3 replies - 1 through 3 (of 3 total)
  • You *might* see of they can use a couple of methods to fix it. One would be:

    O\’Brien – PHP will add slashes to something unless “stripslashes” is used, so it could be that the login is looking for the additional slash.

    Alternatively, WP may change weird characters to the HTML character, so it could be looking for “O& #39;Brien” (had to put a space in there because the forum was parsing it – but remove the space between the “&” and “#”)

    That’s just a couple of possibilities off the top of my head – hope something works for you.

    Well, same old story – I’ve “solved” my own problem.

    The apostrophe seems only to be a problem in the user name field.

    Recently I have built a site with over 1400 authors, so I made the user name equal a sequential number and put the author’s name in the first name field (last name comma first name). Then made display as = first name.

    Result – no problem printing apostrophes. Changed my template to always pick display name for reporting purposes. Easy as..


    Tedinoz, I’ve just encountered precisely the same problem with a user called “O’Brien”, so it’s good to see the answers here.

    Can anyone tell me, please, how you change the template “to always pick the display name for reporting purposes?”

    Many thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Apostrophe in user name’ is closed to new replies.