0

What I want is, give different Roles different kind of access to the user profile. For example, I want to show the section "Name" but not the section "Contact information". From other sections I just want to remove a select box and a textfield, but not everything. Also the Yoast SEO configuration and the mailchimp list selection I dont want to show to the user.

How can I remove/hide those things?

0

Use the function current_user_can( $capability ). Where $capabilty applies.

For example:

If ( current_user_can( 'update_plugins' ){
//do some update plugin stuff
}
  • This doesn't help me. I know that function. But this doesn't allow me to specify different fields in the user profile to be shown or not to different roles. – humpdi Jan 22 '16 at 13:08
  • That is not what you asked. What user profile? Where is the code you have attempted? – Nathan Powell Jan 22 '16 at 13:15
  • The user profile in the backend. When a user logs in and clicks on the page "Your profile" in wp-admin. There are different sections like "Name", "Contact information", "About you" etc. I want to remove certain sections for different roles. For example, users with Role A should see "Name" but should not see others. Users with Role B should see "Contact information" and "About" but not "Name". – humpdi Jan 25 '16 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.