The Linux Page

WordPress user "nicename" and spaces

Today I noticed that I had quite a few 404 errors on one of my websites. That one uses Wordpress that I got from someone else. Because I wanted to include a blog, I had to change the login name and Wordpress does not allow you to do that by default.

So to change the login and password, I directly edited the database makeing user 1 me, essentially.

I replaced the user_login and user_nicename with my own name. This worked just fine. At least at first it looked like everything was working right. Then I noticed that the author link had my name in it. The one with the space. Something like https://linux.m2osw.com/author/Alexis%20Wilke/ which definitively looks like a valid URL.

The problem here is that Wordpress doesn't know how to handle the space (the %20) in that URL. So it cannot find the author and returns a page not found error instead.

The fix is to correctly define the user_nicename field. The author link that Wordpress shows on all the Blog pages you write comes from the user_nicename field.

So I went back to the database and changed that field:

UPDATE wp_users SET user_nicename = 'alexis-wilke' WHERE ID = 1;

Now everything works as expected. The author link shows as: .../author/alexis-wilke and sends me to the list of posts I wrote on that Wordpress site.