How you can Create User with All the Data Programmatically:

Today, we are going to teach you how you can create a WordPress user programmatically with all the data using either wp_create_user() or wp_insert_user() functions, so in this tutorial, we will gonna show you the difference between them and we will gonna look through some examples as well.
Difference Between wp_create_user() and wp_insert_user()
These functions will only allow you to provide a username, password, and email when creating a user. A user will be created with a default role, which is set in Settings > General.
You can change this value in settings.
More than that, wp_create_user() works on the base of wp_insert_user().
wp_insert_user()
It is a complete way of creating a WordPress user programmatically with all the data; you can provide other quite useful data like first and last names, a display name, a user role, and so on.

A complete example of creating a user with all the data

Inside the WordPress admin profile page, you will see a lot of settings and fields here inside the settings.
Let’s see how you can programmatically provide the data for all the fields. Most of these can be passed as arguments to the wp_insert_user() function, but some can be provided only with the help of the update_user_meta() function.

$data = array(
'user_login' => 'qaisar',
'user_nicename' => 'qaisar',
'nickname' => 'qaisar',
'user_email' => 'qaisarssatti@gmail.com',
'user_pass' => 'qaisar123!@',
'first_name' => 'Qaisar',
'last_name' => 'Satti',
'display_name' => 'Qaisar Satti R',
'user_url' => 'https://qaisarsatti.com',
'description' => 'Here is my intro',
'rich_editing' => 'true',
'syntax_highlighting' => 'true',
'comment_shortcuts' => 'false',
'admin_color' => 'fresh',
'use_ssl' => false,
'user_registered' => '2022-10-11 00:00:00',
'show_admin_bar_front' => 'true',
'role' => 'subscriber',
'locale' => '', );
wp_insert_user( $data );

Qaisar Satti

Hi, I'm Qaisar Satti! I've been a developer for over 20 years, and now I love sharing what I've learned through tutorials and guides. Whether you're working with Magento, PrestaShop, or WooCommerce, my goal is to make your development journey a bit easier and more fun. When I'm not coding or writing, you can find me exploring new tech trends and hanging out with the amazing developer community. Thanks for stopping by, and happy coding!