Add user to WP programmtically

Posted by Z3Ro in Wordpress on Sunday, November 22, 2015
1
0
Type: POST
Size: 0 KB
Dimensions: 0x0
Added: Sunday, November 22, 2015 10:41
Modified: Monday, November 30, -0001 00:00
Just a quick code snippet.
$userdata = array( 'ID' => '', 'user_pass' => wp_generate_password(), 'user_login' => $name, 'display_name' => $name, 'first_name' => $first, 'last_name' => $last, 'role' => get_option('default_role') ); $user_id = wp_insert_user( $userdata ); wp_set_password($pass, $user_id);
This site uses google analytics, if you want to avoid being tracked you can use the following app by Google to hide yourself from all analytics tracking.
I accept the terms and conditions of this service.