I don't know why it's so hard to find a solution for this but nothing seems to work when i finally find an answer..

I want to simply make the default display name as the users login/username..

I know I can edit each user, but I want it to be set like that for everyone and everyone that registers in the future.

Any ideas?


  • From a security point of view this might not the best idea as it could expose the usernames on the site and make brute forcing passwords a bit easier
    – Dylan
    Commented Mar 15, 2014 at 1:59
  • I understand this and am aware. We are a small group of people on a private site so it's not a concern. Thanks
    – KJThaDon
    Commented Mar 15, 2014 at 3:30
  • How is the author info displayed in your templates? What is so specific about the display name? Please list all the info that users are entering and data samples with an edit.
    – kaiser
    Commented Mar 15, 2014 at 11:21

1 Answer 1

 * Set new user's display name as their login.
 * @link http://wordpress.stackexchange.com/q/138034/1685
 * @param int $user_id
function wpse_138034_display_name_as_login( $user_id ) {
    if ( $user = get_user_by( 'id', $user_id ) ) {
        // Prevent infinite loop.
        remove_action( 'user_register', __function__ );

                'ID' => $user_id,
                'display_name' => $user->user_login,

        // All done, restore.
        add_action( 'user_register', __function__ );

add_action( 'user_register', 'wpse_138034_display_name_as_login' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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