Add new users to “add new user” page on admin’s dashboard

Check out the source of wp-admin/user-new.php. You’ll see WP uses the function edit_user to create the user in the database.

If you inspect the source of edit_user(), you’ll see the best candidate is a hook called user_profile_update_errors. We can use that with something like:


function wpse_406364_save_nicename( $errors, $update, $user ) {
    if ( ! $update ) {
        $user->user_nicename = sanitize_text_field( filter_input( INPUT_POST, 'cpf' ) );
    }
}

add_action( 'user_profile_update_errors', 'wpse_406364_save_nicename', 10, 3 );

That will set the user_nicename user field to the value of the cpf POST input, and only on user creation.