Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › User Profile Fields › Reply To: User Profile Fields
27/01/2023 at 05:07
#8158
Vladimir
Keymaster
In the provided piece of code the key line is missed:
add_action('admin_init', 'user_profile_fields_disable');
It links your function to the hook which executes it.
Also pay attention that JavaScript code disables only input fields. It can not disable any other visible element. If you wish to hide some element on a page you should use another jQuery code, like
jQuery('#div_id').hide();