assign roles to users in custom drop down in signup form
You have to set user role using user id. use below code to assign role to user. add below code after this line : $user_id = wp_create_user($firstname,$lastname,$email); set role to new created user. by default it will set subscriber role. $user_id_role = new WP_User($user_id); $user_role = !empty($_POST[‘role’]) ? $_POST[‘role’] : ‘subscriber’; $user_id_role->set_role($user_role); i have tested … Read more