WordPress Author Page Not Found (Error 404) if Space in URL?

I had a strange error on this WordPress installation: The autor page would not display, instead I got a 404 (not found). This is the description of how I fixed it.

The Problem

Below each blog post, WordPress typically displays a link to the author. If you click on it, you navigate to the author’s page, which lists all posts by that specific author. This is what the link looks like on this site:

The URL WordPress generated for that link was in my case: https://helgeklein.com/blog/author/Helge%20Klein/

Notice something? It has a space in it, encoded as “%20”. And that seems to be the cause of the problem. When clicking on the link, WordPress cannot find a corresponding page and displays the 404 error page.

I did not find a way to change the author link in the user interface. Neither does my user name include a space. And it has posts associated with it (I mention this because some people have reported getting a 404 for users without posts).

The Resolution

After searching for too long I found the solution here. It is pretty easy, given that you are not afraid of editing the database directly. What you need to do is locate your user record in the table “wp_users” and edit the field “user_nicename”. That is easiest done via phpMyAdmin. In my case the nice name was “Helge Klein”. I changed it to “Helge-Klein”, replacing the space with a dash and the problem was gone.


5 Responses to WordPress Author Page Not Found (Error 404) if Space in URL?

  1. Sk September 14, 2012 at 12:42 #

    Thank you! I had the same problem with the author’s link. It got solved. Thanks a lot.

  2. Tim Hall April 27, 2013 at 13:59 #

    Thanks! I had the exact same problem, now fixed thanks to this blog post.

  3. Separated-Name December 12, 2013 at 10:22 #

    Thank you very much!!! I finally solved this incredible problem :)

  4. Matt Brotherson November 3, 2014 at 23:20 #

    Thanks for the info. Finally got around to fixing this pesky 404, without code changes.

  5. Andrei June 4, 2015 at 12:33 #

    If you want a quick fix, you can run this MySQL query to remove spaces from the nicename:

    UPDATE `wp_users` SET `user_nicename` = REPLACE(`user_nicename`, ‘ ‘, ”) WHERE `user_nicename` LIKE ‘% %’;

    or to replace spaces with a dash:

    UPDATE `wp_ewzn25_users` SET `user_nicename` = REPLACE(`user_nicename`, ‘ ‘, ‘-‘) WHERE `user_nicename` LIKE ‘% %’ limit 1;

Leave a Reply