DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Hide Blocks From Specific Users in the WordPress Editor

Control which block types selected WordPress editors can insert with allowed_block_types_all, or choose a different method to restrict editing or hide published content.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To hide block types from selected editors in WordPress, filter the block types offered in the editor’s inserter with allowed_block_types_all and check the current user’s capability. This changes what users can insert; it does not remove blocks already in a post or hide published content from site visitors. If you mean either of those, use block locking or front-end visibility controls instead.

Choose what you need to hide

Goal Where the restriction applies Approach
Stop selected editors adding block types Editor inserter Use allowed_block_types_all with a capability check.
Prevent editors changing or unlocking existing layout blocks Editing actions Use the Block Locking API and configure who can lock or unlock blocks.
Hide authored content from certain visitors Front-end rendering Use conditional visibility controls; an inserter restriction does not control what visitors see.

The distinction matters: restricting blocks in the Gutenberg inserter controls block availability during editing, not permissions to view a published page.

Restrict block types with allowed_block_types_all

WordPress documents allowed_block_types_all as the server-side filter for available block types. It can return true, false, or an array of allowed block names. The older allowed_block_types filter is deprecated. See the Block Filters reference and WordPress Developer Blog’s guide to disabling specific blocks.

An allow-list is straightforward when a user should have access to only a small set of blocks. Use a capability that corresponds to the permission you intend to target rather than assuming every site’s roles are configured identically. WordPress’s current_user_can() reference explains capability checks, including how meta capabilities are mapped to primitive capabilities.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example: limit users who cannot publish pages

This example lets users with the publish_pages capability keep the default block availability and limits other users to a short list. Replace the block names with the ones appropriate for your site.

add_filter( 'allowed_block_types_all', function ( $allowed_blocks, $editor_context ) {
    if ( current_user_can( 'publish_pages' ) ) {
        return $allowed_blocks;
    }

    return array(
        'core/paragraph',
        'core/heading',
        'core/list',
        'core/image',
    );
}, 10, 2 );

The hook passes the existing allowed-block value and editor context to the callback. Returning the existing value for users who should retain access avoids replacing the site’s existing behavior for those users. The official tutorial demonstrates conditional restrictions based on user capabilities and the edited post type; see its examples if the rule should also depend on post type.

When a disallow-list is easier

If users should retain most blocks and lose only a few, it may be easier to start with the available block list and remove selected names. WordPress’s tutorial includes both allow-list and disallow-list patterns, including conditions based on capability and post type. Choose the form that will be easiest for your site to maintain as its block set changes.

Where to put the code and how to verify it

  1. Confirm the target. Identify whether the restriction must apply in the Post Editor, Site Editor, or both, and note the site’s WordPress version and the relevant users’ capabilities.
  2. Add the filter in maintainable site code. Put the snippet in a small site-specific plugin or a child theme rather than editing a parent theme directly.
  3. Test with representative accounts. On a staging site, sign in as a restricted editor and an unrestricted editor, then check the inserter in the editor(s) you intend to control.
  4. Check existing content separately. Confirm that your intended rule concerns insertion only. Existing blocks and front-end display require their own controls.

Role names can be misleading on sites where roles have been customized by the site or plugins. Select a capability matching the action you want to govern, and verify the result using accounts with the relevant permissions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a different method for existing blocks or visitors

Existing layout blocks: block locking

If editors may add a block but must not move, remove, or otherwise alter an existing layout, investigate the Block Locking API. WordPress documents block_editor_settings_all as a way to control locking permissions. Locking addresses editing actions; it is not a replacement for hiding block types from the inserter.

Published content: visibility rules

If the actual aim is to hide a block from logged-in users or show content only to particular visitors, use front-end visibility rules. The Block Visibility listing describes controls for specific users and roles. RenderWhen for Blocks describes conditions based on user state and role, along with role-preview functionality. These affect whether content is rendered for visitors, rather than which blocks editors can insert.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When a plugin interface may fit better

For a graphical, role-based setup instead of custom code, Block Editor Roles describes per-role controls over block insertion and editing, including limiting editing to text changes. Its WordPress.org listing, accessed in 2026, reported fewer than 10 active installations and compatibility tested up to WordPress 6.9.9; those are time-sensitive listing details, not a guarantee of current maintenance or compatibility. Check the current listing and test on your own WordPress version before relying on it.

Use a plugin only after confirming that its controls match the job: editor block availability, editing restrictions, and visitor visibility are separate functions. Availability and compatibility can change between plugin releases.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.