I have created various user roles in my wordpress website.
I want to add extra custom fields based on particular user roles.
For Example, If user role is lawyer then "state" field is added to user at add time and also update time.
I have created custom field "state" for that and selected user equals to lawyer.But this state field comes at update time only.
I want to add this field in add user time when user select the role lawyer then this field needs to be display at adding user also updating user.
Do i need to add ACF PRO version for this. I am using ACF basic version now. Please advice how to acheive it?
Please check this hook.
add_action('show_user_profile', 'my_add_extra_profile_fields');
function my_add_extra_profile_fields($user)
{
if ($user->has_cap('subscriber'))
{
//Code here
}
}