/**
* 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__ );
wp_update_user(
array(
\'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\' );