• Resolved Yunis777

    (@yunis777)


    Hello,

    If I want a menu item to be visible to ‘administrator’, ‘candidate’ and non-logged in users, what could should I enter?
    The item should be visible to any user that comes under any of the following roles:
    – administrator
    – candidate
    – non-logged in user (= visitor)
    However, if the user has logged-in and its user role is ’employer’, the item has to be invisible.
    What code should be formulated with this plugin?

    Look forward to hearing from you,

    Yunis

    https://wordpress.org/plugins/menu-items-visibility-control/

Viewing 2 replies - 1 through 2 (of 2 total)
  • the easiest thing I could think is:

    do you have only those 4 roles? (admin, candidate, employer and non-logged)

    if yes, you could use

    !current_user_can('employer')

    otherwise you can always use || operator to verify multiple conditions and the function current_user_can()

    !is_user_logged_in() || current_user_can('administrator') || current_user_can('candidate')

    Thread Starter Yunis777

    (@yunis777)

    Davide,

    The code you gave me for the plugin customization worked. Thanks.

    Regards,

    Yunis

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Visibility depending user role’ is closed to new replies.