WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a simple directory from the user accounts and want to simplify it as much as possible for the users. I changed the label on nickname to Lastname, Firstname so that the users can be alphabetized by the nickname field, but I want the display_name to default, or even force, to the nickname field. I haven't seen a plugin, so I'm looking for something I can add to the functions to do this. Any ideas?

share|improve this question
up vote 4 down vote accepted

You can force this with a hook that activates when the profile is updated. The next step would be to hide the display_name select box, you can do that with some Javascript.

add_action( 'user_profile_update_errors', 'wpse7352_set_user_display_name_to_nickname', 10, 3 );
function wpse7352_set_user_display_name_to_nickname( &$errors, $update, &$user )
    if ( ! empty( $user->nickname ) ) {
        $user->display_name = $user->nickname;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.