Device Display for Blocks

Hide any block on desktop, tablet or mobile with a few toggles.

Lauren Gray Avatar

Device Display for Blocks lets you hide any block on desktop, tablet or mobile with a few toggles in the block sidebar. You can also set your own breakpoints, so “tablet” means what your theme means by it.

Before you start

  • WordPress 5.8.3 or later
  • PHP 5.6 or later
  • The block editor

Install

  1. In your WordPress dashboard, go to Plugins → Add New Plugin.
  2. Click Upload Plugin.
  3. Choose the plugin zip file.
  4. Click Install Now.
  5. Click Activate.

How to use

Hide a block on a device

  1. Open a post or page in the block editor and select the block.
  2. In the block settings sidebar, open the Block Visibility panel.
  3. Turn on Hide on desktop, Hide on tablet or Hide on mobile. You can turn on more than one.
  4. Save or update the post, then check it on the front end.

The block stays visible while you edit, so you can still find and change it. As the panel’s tip says, These changes will only work on frontend. To see which blocks are hidden, select a block and check its Block Visibility panel.

Set your breakpoints

  1. Go to Settings → Device Display for Blocks.
  2. Enter a minimum screen width in pixels for Desktop and Tablet.
  3. Click Save Changes.

Settings

Each breakpoint is the minimum screen width (in pixels) for that device. Anything narrower than the tablet width counts as mobile.

  • Desktop: default 1024. Screens this wide or wider count as desktop.
  • Tablet: default 781. Screens from this width up to one pixel below the desktop width count as tablet.

With the defaults, mobile is up to 780px, tablet is 781px to 1023px and desktop is 1024px and up.

Developer reference

Coming soon: the hooks, filters and functions you can use with this plugin from your theme or a code snippet.

FAQs

How does it hide the block?

Each toggle adds a CSS class to the block (hide-on-desktop, hide-on-tablet or hide-on-mobile), and the plugin’s styles hide that block at the matching screen size. The block is still in the page’s HTML, just not shown.

My theme’s styles keep the block showing. What can I do?

The plugin also has stronger versions of each class: hide-on-desktop-important, hide-on-tablet-important and hide-on-mobile-important. Add one under Advanced → Additional CSS class(es) in the block sidebar. Changing the toggles afterward removes it, so re-add it if you switch them.

Who can change the breakpoints?

Administrators.