[wp-trac] [WordPress Trac] #55655: Throw a _doing_it_wrong in register_block_pattern if not registered on `init` hook.
WordPress Trac
noreply at wordpress.org
Mon May 2 15:28:05 UTC 2022
#55655: Throw a _doing_it_wrong in register_block_pattern if not registered on
`init` hook.
-------------------------------------------------+-------------------------
Reporter: johnstonphilip | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: General | Version: trunk
Severity: normal | Keywords: needs-patch
Focuses: administration, rest-api, coding- |
standards |
-------------------------------------------------+-------------------------
In WP 6.0, block patterns are now being loaded after initial page load via
the REST API.
This means that any block patterns not registered on the `init` hook will
no longer show up.
Therefore, the
[https://developer.wordpress.org/reference/functions/register_block_pattern/
register_block_pattern] function should only be used on the `init` hook,
and if not, it should throw a
[https://developer.wordpress.org/reference/functions/_doing_it_wrong/
_doing_it_wrong] so the code author knows.
For more see:
https://github.com/WordPress/gutenberg/issues/40736
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55655>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list