|

Display Conditions

Introduction

Display Conditions let you control whether a block appears based on who is viewing it and when. You can hide a block by user state, user role, browser, operating system, or day of the week. When a condition hides a block, the block is completely removed from the page output, so it isn’t just visually hidden, it’s never sent to the browser at all. For example, you can hide a members area block from logged out visitors, or hide a banner on specific days.

How to Use Display Conditions

  1. Select the block you want to control.
  2. In the settings sidebar, open the Block tab and find the Display Conditions panel.
  3. Set the conditions for when the block should be hidden.
  4. Save or publish the page to apply your changes.
display conditions

The Conditions

Each condition hides the block when it’s met. Leave a condition unset to ignore it.

  • Hide From Logged In Users: Turn this on to hide the block from anyone who is logged in.
  • Hide From Logged Out Users: Turn this on to hide the block from visitors who are not logged in.
  • Hide For User Role: Hide the block from a specific role, such as Subscriber, Customer, Editor, or Administrator. The roles you can choose depend on your site.
  • Hide For Browser: Hide the block for a specific browser, such as Chrome, Firefox, Safari, Edge, or Opera.
  • Hide For Operating System: Hide the block for a specific operating system, such as Windows, macOS, Linux, iOS, or Android.
  • Hide On Days: Check the days of the week the block should be hidden on.

Good to Know

  • Hidden blocks are completely removed from the page output. They’re not just hidden with CSS, so they don’t reach the visitor’s browser at all.
  • These conditions are checked for each visitor when the page loads, so they won’t take effect while you’re editing. The block always shows in the editor, so check the live page to see the result.

A Few Tips

  • To make a block visible only to members, turn on Hide From Logged Out Users so it shows only once someone signs in.
  • Day conditions are handy for time limited content, like hiding a weekday notice on Saturday and Sunday.
  • Since the block always appears in the editor, use a private or incognito window, or a different account, to confirm how each condition behaves on the live site.

Disabling Display Conditions for Specific Post Types

If you want to turn Display Conditions off for certain post types, add a filter to your child theme’s functions.php file. We recommend using a child theme so your changes aren’t lost when the theme updates.

To turn Display Conditions off everywhere:

php

add_filter( 'enable_block_condition', '__return_false' );

To turn it off for a specific post type, such as Pages:

php

add_filter( 'enable_block_condition', function ( $enabled ) {
    if ( isset( $_REQUEST['post_type'] ) && 'page' === $_REQUEST['post_type'] ) {
        return false;
    }
    return $enabled;
} );

Frequently Asked Questions

What can I hide a block based on?
User state (logged in or logged out), user role, browser, operating system, and day of the week.

Are hidden blocks just visually hidden?
No. When a condition hides a block, it’s completely removed from the page output, so it never reaches the visitor’s browser.

Why doesn’t the block hide while I’m editing?
The conditions are evaluated for each visitor when the page loads, not in the editor. The block always shows while editing, so confirm the result on the live page.

Can I make a block appear only to logged in users?
Yes. Turn on Hide From Logged Out Users, and the block will only show to people who are signed in.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support

Get Notified When Available

Note - You can purchase the Essential Toolkit now and easily upgrade to the Business Toolkit once it becomes available.

Get your hands on Spectra Pro

Enter your name and email address to get access to Spectra Pro.