how to import contacts from php to wordpress

By default, when adding a new user using either wp_create_user() (https://developer.wordpress.org/reference/functions/wp_create_user/) or wp_insert_user() (https://developer.wordpress.org/reference/functions/wp_insert_user/) the password is passed in as a plain-text string, and the WP functions will encrypt into the wp_users table.

There are some plugins out there that will allow import from a CSV (example: https://wordpress.org/plugins/import-users-from-csv/)

If you are looking at writing your own code to loop through data you can use the functions above as needed, allowing you to pass in the password string as plain-text along with other related user data.

If you are looking at creating a new password on the fly as you create the users you can use wp_generate_password() (https://developer.wordpress.org/reference/functions/wp_generate_password/) and pass the returned value into the user data for the user being added.

tech