Title: PHP boolean expression for hide user roll
Last modified: September 7, 2020

---

# PHP boolean expression for hide user roll

 *  Resolved [nievesa2colores](https://wordpress.org/support/users/nievesa2colores/)
 * (@nievesa2colores)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/)
 * Hi.
    I have tested the plugin and it works perfectly with the example you give
   to hide elements from non-logged in users. But I need it to hide elements to 
   certain user roles and I don’t know anything about php. Can you please provide
   me with more php expressions that can be applied in the plugin to get more out
   of it? Thank you!!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fphp-boolean-expression-for-hide-user-roll%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * (@jhorowitz)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/#post-14033224)
 * Hi [@nievesa2colores](https://wordpress.org/support/users/nievesa2colores/),
 * To hide from a specific role:
    `!current_user_can('role_name')`
 *  Thread Starter [nievesa2colores](https://wordpress.org/support/users/nievesa2colores/)
 * (@nievesa2colores)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/#post-14036056)
 * Hi Jonathan!
    Thanks And if I want to hide the content from more than one role?
   how would the expression be? I have tried different ways but it doesn’t work :(.
 * I would appreciate your help.
    Thanks in advance!
 *  Plugin Author [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * (@jhorowitz)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/#post-14038356)
 * Simply list them all separated by &&, like this:
 * `!current_user_can('role_name') && !current_user_can('other_role_name')`
 * That will hide for either role. 🙂
 *  [dragun20003](https://wordpress.org/support/users/dragun20003/)
 * (@dragun20003)
 * [5 years ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/#post-14431284)
 * hi, i have a lot of roles on my website, wanted to know if we can say like : 
   all roles cant see it except “that role”

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘PHP boolean expression for hide user roll’ is closed to new replies.

 * ![](https://ps.w.org/content-visibility-for-divi-builder/assets/icon-256x256.
   png?rev=1359961)
 * [Content Visibility for Divi Builder](https://wordpress.org/plugins/content-visibility-for-divi-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-visibility-for-divi-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [dragun20003](https://wordpress.org/support/users/dragun20003/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/php-boolean-expression-for-hide-user-roll/#post-14431284)
 * Status: resolved