I'm struggling with a database issue. I took control over a solution created by someone else.
When inserting / updating users in the database, the earlier developers wrote a custom database script to update the wp_users
table, and not through WordPress's API. They found out that they would use the user_nicename
column for storing the first name of the user, and the display_name
for storing the last name of the user. The names contains characters outside the english alphabet.
The script writes to these columns and we end up with a user_nicename
like Harald Åge, which contains spaces and non-english characters. When using WordPress's API, it tries to make the user_nicename
URL-friendly, but when using a database script to insert / update the user directly, WordPress won't have anything to say about this.
So now we have a partially corrupted database with non-URL-friendly user_nicename
s.
My question is: Is there any way to regenerate these URL-friendly fields?
I guess it's possible to write a custom php-script which goes through all the users one by one and try to update the user_nicename
value, or by letting WordPress handle that itself. Is there any other way of doing this?
And, in the future, we want to store the user's first name and last name in the wp_usermeta
table instead, like WordPress does.