Linux 软件免费装
Banner图

BlockSieve – Display Conditions for Blocks

开发者 jahirulwp
更新时间 2026年10月30日 00:42
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

gutenberg user role conditional blocks block visibility conditional content

下载

1.0.0 1.1.0

详情介绍:

BlockSieve adds conditional visibility to every block in the WordPress block editor (Gutenberg). Select a block, open its Visibility panel in the sidebar, and choose who sees it, when it appears, on which pages and on which devices, without writing code or custom CSS. It works with core and third-party blocks in posts, pages, custom post types, Site Editor templates and template parts, synced patterns, navigation menus, block widgets and Query Loops, including WooCommerce product templates, with block and classic themes, on single sites and multisite. Twelve block visibility conditions, all free Combine as many conditions as you need on one block, and choose whether all of them must match or any one is enough. What you can build Hidden blocks are removed on the server BlockSieve evaluates conditions in PHP while WordPress builds the page. A hidden block's HTML never reaches the browser, so it cannot be revealed by viewing the page source. The Device condition is the one exception: it uses CSS, so the block stays in the page and is hidden on the deselected screen sizes. There is no front-end JavaScript, blocks without conditions are skipped immediately, and a small stylesheet loads only on pages that use the Device condition. If a condition ever becomes invalid, BlockSieve shows the block instead of hiding it. Visibility report: find every block with conditions Tools → BlockSieve lists every block on the site that has visibility conditions, wherever it lives. Each row shows the conditions in plain words, an edit link, and a preview of whether a logged-out visitor or an administrator would see the block. It warns about leftover condition types from removed plugins, empty role or page lists, date ranges that have already ended and conditions that contradict each other. Filter and search the list, or check the totals in the Block Visibility widget on the Dashboard. For developers Register custom condition types with the blocksieve_register_conditions action and the editor lists them automatically. Override any decision with the blocksieve_result filter, and tune the report's cache lifetime, scan limit and post types with filters. The docs/ folder documents every hook and filter, and the readable editor source ships in src/. Privacy BlockSieve runs entirely on your own server. It does not contact any external service, load files from a CDN, collect usage data or set cookies. It stores one option for its settings and one short-lived transient for the cached report, and removes both when you delete the plugin. Your visibility rules are saved inside the block content itself.

安装:

  1. In your dashboard, go to Plugins → Add New Plugin, search for BlockSieve and click Install Now. Or upload the blocksieve folder to /wp-content/plugins/.
  2. Activate the plugin.
  3. Select a block, open the Visibility panel in the block sidebar, turn on Enable visibility conditions and add the conditions you need.

屏幕截图:

  • Several conditions on one block, matched with "All conditions" or "Any condition".
  • The Block Visibility report, with a visitor and administrator preview for every block.
  • The Block Visibility summary widget on the Dashboard.

升级注意事项:

1.1.0 New name, PHP 7.4 support, multi-select Page View and a Page / Post picker that lists unpublished items. Rules and settings are kept. 1.0.0 Initial release.

常见问题:

How do I show a block only to logged-in users or a specific user role?

Add a Logged In condition to the block. To limit it further, add a User Role condition and tick the roles that should see it.

Can I schedule a block to appear and expire automatically?

Yes. Use Date Range for a one-off schedule, or Weekdays and Time Range for a recurring one, for example weekdays from 9:00 to 17:00.

Can I hide a block on mobile, tablet or desktop?

Yes. Add a Device condition and keep only the devices the block should appear on. Mobile is narrower than 782 pixels, tablet is 782 to 1024 pixels, and desktop is wider. Because it uses CSS, it reacts when a window is resized.

WordPress already has a Hide option for blocks. Why use BlockSieve?

WordPress can hide a block everywhere, and since version 7.0 it can hide a block on chosen screen sizes. BlockSieve adds conditions based on who is visiting, when they visit and which page they are on. You can use both on the same site.

Can I hide several blocks at once?

Yes. Put them in a Group or any other container block and add the conditions to the container. When the container is hidden, everything inside it is hidden too.

Does it work with third-party blocks, block themes and the Site Editor?

Yes. The Visibility panel is added to every block type registered with the editor, including blocks from block library plugins and WooCommerce, and conditions are enforced wherever those blocks are used.

Does it work with the Classic Editor, Elementor or other page builders?

No. BlockSieve works with content built in the block editor. Classic Editor content, the Classic block and page builder layouts are not blocks and do not get the Visibility panel.

Will I still see hidden blocks while editing?

Yes. Conditions only apply on the front end, so every block stays visible in the editor.

Is this a security or membership plugin?

No. It is a content display tool for tailoring what people see, not for protecting files or sensitive data. Use a membership or access-control plugin for those.

Does it work with page caching?

Conditions are checked when a page is built, so a page cache serves whatever version it stored first. Visitor-based conditions (Logged In, Logged Out, User Role, URL Contains, Query Parameter) and time-based conditions need a fresh page: bypass the cache for logged-in users and exclude pages that use the other conditions. The Device condition works with any cache because it uses CSS.

What happens if I deactivate the plugin?

Nothing is lost. Conditions are stored inside your block content, every block shows while the plugin is inactive, and the conditions apply again when you reactivate it.

Does it work on multisite?

Yes. Activate it per site or network-wide. Each site keeps its own settings, and deleting the plugin cleans up every site.

更新日志:

1.1.0 1.0.0