how to make a custom field readonly or disabled by user role?
First, you can get the current user object like so: $user = wp_get_current_user();. The $user object would have a roles property containing the user’s roles, so you can do the following to check if the current user has a specific role: in_array( ‘role_slug’, $user->roles ). And then in your field HTML, you can use the … Read more