[wp-trac] [WordPress Trac] #63765: register_block_pattern() returns true even when disallowed blocks are used, causing silent failure in the editor.
WordPress Trac
noreply at wordpress.org
Tue Jul 29 06:15:27 UTC 2025
#63765: register_block_pattern() returns true even when disallowed blocks are used,
causing silent failure in the editor.
--------------------------+-----------------------------
Reporter: tusharbharti | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.8.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
== Description ==
This issue was initially reported in the Gutenberg GitHub repo
(https://github.com/WordPress/gutenberg/issues/59413).
When registering a block pattern using `register_block_pattern()`, if the
pattern includes blocks that are not explicitly allowed via the
`allowed_block_types_all` filter, the function still returns `true`.
However, the pattern does not appear in the editor's pattern inserter, and
no warning or error is shown.
This behavior is inconsistent. For example, the `core/column` block is
usable inside the editor if `core/columns` is whitelisted, even without
explicitly allowing `core/column`. But when used in a pattern,
`core/column` must be separately whitelisted, or the pattern is silently
skipped.
== Steps to Reproduce ==
1. Use `allowed_block_types_all` to only allow `core/columns`.
2. Register a pattern containing both `core/columns` and `core/column`.
3. Visit the editor and open the pattern inserter.
4. The pattern will not appear, though `register_block_pattern()` returned
true.
== Expected Behavior ==
- Either register_block_pattern() should return false or log a warning
when the pattern includes disallowed blocks.
- Or nested blocks (like core/column) should be implicitly allowed when
their parent (like core/columns) is whitelisted, for consistency.
== Actual Behavior ==
- register_block_pattern() returns true.
- The pattern does not appear in the inserter.
- No error or warning is provided.
== Proposal ==
Add block-type validation to `register_block_pattern()` that checks
pattern content against the current block whitelist
(`allowed_block_types_all`). If disallowed blocks are found, return
`false` or trigger a developer warning.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63765>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list