Modules / Visibility & conditions

Condition: user capability

Show or hide an element by a WordPress capability, such as edit_posts or manage_woocommerce, instead of by role.

#31 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer
  • Tested with Bricks 2.4.3
Recording: someone gives the staff bar the condition User can, has capability, edit_posts; a logged-out visitor gets no bar, and an administrator sees it on the same page.Recorded in Bricks 2.4.3

How to use it

  1. Select the element and open its Conditions.
  2. Add the condition User can from the Kiln group.
  3. Choose has capability or lacks capability.
  4. Type the capability name, for example edit_posts.

A capability from a membership plugin or another plugin works the same way. Type its name as that plugin documents it.

Where it appears in Bricks

Element conditions: User can, in the Kiln group.

Limits

  • Use primitive capabilities, such as edit_posts or manage_options. A capability that needs an object ID, such as edit_post, is not supported.
  • A name can hold letters, digits, underscores and hyphens. Anything else, or an empty field, makes the condition false.
  • A visitor who is logged out has no capabilities. lacks capability is true for them.
  • The field takes a plain name. It does not render dynamic data.

Settings

None. Turn the module on in Bricks > Kiln (it is on by default).

Requirements

Bricks 2.4 or newer.