Is It A Good Idea To Change Author Slug (user_nicename field) Directly In MySQL DB?

Searching for a how-to on changing author slug, I found two methods:

  1. Change the user_nicename field in the MySQL database of your WordPress site to whatever you want the slug to be.

  2. Changing the Author Slug from Username to Nickname

The (2) is out of question because I want the slug to be something custom, but not the nickname/nicename.

As for (1) I wanted to know if this is okay — to change the value of user_nicename field in the database for the user?

1 Answer
1

Providing you know what you’re doing that shouldn’t be a problem. You will however have to check that any author/user pages you may have are linked by id rather than name in the code:

$data = get_userdata( $userid );

As opposed to

$data = get_userdata('Admin');

Because the ID will never change (unless you delete the row and re-insert) but if you change Admin to Supreme Overlord, Master of this Domain the second reference will not work but the first will.

NOTE, this will not break the usage of current_user_can($capability) but will break user_can('Admin',$capability) but I don’t see why you would be using user_can() over current_user_can() anyways.

Leave a Comment