Display name publicly as "Name" not "name" (Capital first letter) Automatically?

Hi,
I need the site to Automatically Capitalise the user's Display name publicly

Currently its default is "name" but i need it to be "Name" - see screenshot http://take.ms/9CE3u

Site: http://tinyurl.com/og9nj8e

Support access is open

Thanks

Tom

  • Adam Czajczyk

    Hey Tom,

    I hope you're well today and thank you for your question!

    This code should do the job:

    function wpmu_capitalize_displaynames($user_login, $user) {
    
    	$displayname = ucfirst($user->data->display_name);
         wp_update_user( array ('ID' => $user->ID, 'display_name' => $displayname));    
    
    }
    add_action('wp_login','wpmu_capitalize_displaynames',10,2);

    Add it please to your current theme's functions.php file and it should update (capitalize first letter) user's display name upon login.

    I hope that helps!

    Cheers,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.