Block Visibility
Block Visibility lets you show or hide any Gutenberg block based on a logic expression. The block is rendered or suppressed server-side — it never reaches the DOM when hidden, protecting both performance and sensitive content. Note that expressions entered in this input do not require surrounding brackets {{ }} - the input itself is a single expression.
Setting Up Visibility
- Select any block in the Block Editor.
- Open the Vector Expressions panel in the Block sidebar.
- Find the Visibility section.
- Choose either Show if True or Hide if True.
- Enter your expression.
Visibility Modes
| Mode | Behaviour |
|---|---|
| Show if True | Block is rendered only when the expression evaluates to truthy |
| Hide if True | Block is rendered only when the expression evaluates to falsy |
Common Patterns
Show to logged-in users only
user.is_logged_in
Show to specific roles only
user.role == "administrator" || user.role == "editor"
Show on a specific post type
post.type == "product"
Hide via post meta flag
post.meta.disable_sidebar != "1"
Show based on membership tier
user.meta.membership_tier == "premium"
Security Note
Hidden blocks are not sent to the browser at all — they are removed from the output before the response is built. This means they cannot be accessed by users who inspect page source. Never rely on CSS-only hiding for sensitive content.