How to hide user profile fields based on the role of the viewed user?
current_user_can() checks the current user’s specified capability. See Roles and Capabilities. Also, CSS just visually hides the section, but does not remove it from page HTML. The following code checks the capability and completely removes the section. <?php // For example, // any user other than an Admin of single site installation, // but not … Read more