[Resolved] Exclude user role from hook

Home Forums Support [Resolved] Exclude user role from hook

Home Forums Support Exclude user role from hook

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1176623
    Sam

    Hi, is there a way to exclude user roles from hooks? I see you can exclude locations.

    I would like to exclude user role administrator for a hook.

    thanks
    Sam

    #1176797
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can’t exclude them, but you can include them: https://docs.generatepress.com/article/hooks-element-overview/#display-rules

    That means you can choose the rules you want to apply the Hook to.

    Otherwise, you’d need to use a filter to exclude a role.

    #1177098
    Sam

    Hi Tom, ok noted. Would you mind confirming the below logic is correct? To apply the hook to either logged out users or woocommerce customers, I should include only “logged out users” and “customers”. And this would then exclude all other users?

    What about if a “customer” was logged in would it still include then because the role is set?

    thanks
    Sam

    #1177781
    Tom
    Lead Developer
    Lead Developer

    The logic uses “or”, so if one of the conditions is met, it should display.

    Let me know if you need more info ๐Ÿ™‚

    #1317069
    Sam

    OK thanks for your help.

    #1317362
    Tom
    Lead Developer
    Lead Developer

    No problem ๐Ÿ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.