Change WordPress user roles and capabilities › Forums › How to or FAQ › Two roles assigned multiple roles › Reply To: Two roles assigned multiple roles
08/05/2020 at 05:26
#6819
Vladimir
Keymaster
Custom code may help only. New user is registered via WordPress internal function wp_insert_user(). This function executes special action:
/**
* Fires immediately after a new user is registered.
*
* @since 1.5.0
*
* @param int $user_id User ID.
*/
do_action( 'user_register', $user_id );
Thus, it’s possible to hook own function to ‘user_register’ action and add secondary role to user according to his primary role.