Viewing 1 replies (of 1 total)
  • Thread Starter chiefplt

    (@chiefplt)

    Ended up figuring it out… Added this code to theme-my-login-custom.php

    function set_default_display_name( $user_id ) {
    $user = get_userdata( $user_id );
    $name = sprintf( ‘%s %s’, $user->first_name, $user->last_name );
    $args = array(
    ‘ID’ => $user_id,
    ‘display_name’ => $name,
    ‘nickname’ => $name
    );

    wp_update_user( $args );
    }

    add_action( ‘user_register’, ‘set_default_display_name’ );

Viewing 1 replies (of 1 total)
  • The topic ‘Custom code for display name to default to first and last name’ is closed to new replies.