wp_insert_user role not working

$WP_array = array (
        'user_login'    =>  $username,
        'user_email'    =>  $email,
        'user_pass'     =>  $password,
        'user_url'      =>  $website,
        'first_name'    =>  $first_name,
        'last_name'     =>  $last_name,
        'nickname'      =>  $nickname,
        'description'   =>  $bio,
    ) ;

    $id = wp_insert_user( $WP_array ) ;

    wp_update_user( array ('ID' => $id, 'role' => 'editor') ) ;

Since you are looking for working solutions, this one should work, and it is only the helpful answer candidate. I am ware that this may not be the best solution, maybe not even close, but it should work.

Leave a Comment